Mojibake on github for Jupyter notebooks

Has anyone else noticed that Github is suddenly rendering any Unicode characters in Jupyter notebooks as mojibake (garbled characters like “—Ô), e.g. in this notebook for my class?

Is there any way to fix it? I don’t recall it happening before — it’s as if they are suddenly interpreting notebooks as Windows-1252 or some other non-UTF8 encoding.

Sorry for the offtopic, but I figured it might have bit other Julia people since we use Unicode so extensively. (My workaround for now is to view notebooks on github via nbviewer.org.)

1 Like

renders fine on firefox version 106 and chrome version 107 on ubuntu 22.04…

Interestingly, I see it on some loads of the page and not others. In one rendition I see the correct text:

rapidly decreasing — you could set

In another rendition I see the mojibake version:

rapidly decreasing — you could set

You can transform the correct version of the non-ASCII bit like this:

julia> text = Char(8212) * Char(160)
"— "

julia> map(Int, codeunits(join(map(Char, codeunits(text)))))
10-element Vector{Int64}:
 195
 162
 194
 128
 194
 148
 195
 130
 194
 160

From which we can infer that some layer of code is treating each code unit as a code point (i.e. interpreting the text as Latin-1), and then some other layer interprets the code units of that text as code units.

1 Like

For me I get “rapidly decreasing — you” i.e. correct (and I can right click get the source and confirm UTF-8 used, I suppose this is a server issue and you would always say that, even if broken). I tried going to:

https://github.dev/mitmath/1806/blob/master/psets/pset7.ipynb

and then I get narrower hyphen, though sort of ok, and can’t right click to get source… (it’s blocked by UI code, and I’m not sure there’s a workaround for that, except maybe by disabling JavaScript).

[Karpinski shows “&#160”, i.e. non-break space on the right of the “em dash”, is that right to do? Copy-pasting I however get a regular ASCII space on both sides… Wikipedia rules have em dash unspaced, and en dash spaced. I believe you would then only use non-break space on the left, but at least on Wikipedia in my Firefox, it doesn’t seems to copy as such, maybe intentional for Firefox.]

I CAN copy paste-this non-break space from the terminal to the terminal, but not from the web:

julia> text = Char(8212) * Char(160)
"— "

Looks like they may have fixed the bug? I can’t reproduce the mojibake anymore.

(I did file a github support request, but didn’t get any response so I assumed they hadn’t looked into it yet.)

1 Like