Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Documentation editor does not allow saving Unicode Supplementary Characters #1775
I was editing the following page:
and was attempting to add the actual character(s) returned by each statement in the existing inline comment to the right of each statement. This would greatly help readers more quickly comprehend the relationship between the input values and the actual behavior of the method. However, each time I tried to "Publish", I would get a "500 Internal Server Error" message. Figuring that the problem was most likely the Unicode characters (and even more likely the supplementary characters), I removed them and was finally able to publish the page.
The two code blocks in the Examples section should have appeared as follows:
String.fromCodePoint(42); // "*" String.fromCodePoint(65, 90); // "AZ" String.fromCodePoint(0x404); // "\u0404" == "Є" String.fromCodePoint(0x2F804); // "\uD87E\uDC04" == "你" String.fromCodePoint(194564); // "\uD87E\uDC04" == "你" String.fromCodePoint(0x1D306, 0x61, 0x1D307); // "\uD834\uDF06a\uD834\uDF07" == "𝌆a𝌇"
// String.fromCharCode() cannot return supplementary characters (i.e. code points // 0x010000 - 0x10FFFF) by specifying their code point. Instead it requires the // UTF-16 surrogate pair in order to return a supplementary character: String.fromCharCode(0xD83C, 0xDF03); // "🌃" == Code Point U+1F303 "Night with String.fromCharCode(55356, 57091); // Stars" == "\uD83C\uDF03" // String.fromCodePoint(), on the other hand, can return 4-byte supplementary characters, // as well as the more common 2-byte BMP characters, by specifying their code point: String.fromCodePoint(0x1F303); // or 127747 in decimal == "🌃"
I will attempt another update to at least add the U+0404 character, "Є", as that will also help narrow down if this bug is isolated to supplementary characters or not. I will add a comment with the results.
Final comment (for now): I think the editor is attempting to translate / convert / do something with the supplementary character rather than just saving it. I had previously tried to specify the characters in question using HTML encoding (e.g.