Skip to content

Commit 0ac5483

Browse files
committed
ensure text/plain output is valid Unicode (closes #927)
1 parent 8c0f770 commit 0ac5483

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/display.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ end
6666

6767
display_mimestring(m::MIME, x) = (m, limitstringmime(m, x))
6868

69+
# text/plain output must have valid Unicode data to display in Jupyter
70+
function display_mimestring(m::MIME"text/plain", x)
71+
s = limitstringmime(m, x)
72+
return m, (isvalid(s) ? s : "(binary data)")
73+
end
74+
6975
"""
7076
Generate the preferred json-MIME representation of x.
7177

0 commit comments

Comments
 (0)