Skip to content

Commit 0eee937

Browse files
committed
Fix decompression of unicode values above 2047
Two problems: The lead byte for 3-byte sequences was wrong, and one mid-byte was not even filled in due to a missing "++"! Apparently this was broken ever since the first "Compress as unicode, not bytes" commit, but I believed I'd "tested" it by running on the Pinyin translation. This rendered at least the Korean and Japanese translations completely illegible, affecting 5.0 and all later releases.
1 parent bdb07ad commit 0eee937

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

supervisor/shared/translate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ STATIC int put_utf8(char *buf, int u) {
5959
*buf = 0b10000000 | (u & 0b00111111);
6060
return 2;
6161
} else { // u <= 0xffff
62-
*buf++ = 0b11000000 | (u >> 12);
63-
*buf = 0b10000000 | ((u >> 6) & 0b00111111);
62+
*buf++ = 0b11100000 | (u >> 12);
63+
*buf++ = 0b10000000 | ((u >> 6) & 0b00111111);
6464
*buf = 0b10000000 | (u & 0b00111111);
6565
return 3;
6666
}

0 commit comments

Comments
 (0)