fix utf8 encoding missing one bit shift

For Unicode code point in the highest range, 1 bit shift operation on the 4th byte is missing, giving a wrong encoding
This commit is contained in:
axeldaguerre
2024-01-30 17:52:19 +01:00
committed by Ryan Fleury
parent 2c73c65878
commit fb9e890653
+1 -1
View File
@@ -1306,7 +1306,7 @@ utf8_encode(U8 *str, U32 codepoint){
inc = 3;
}
else if (codepoint <= 0x10FFFF){
str[0] = (bitmask4 << 3) | ((codepoint >> 18) & bitmask3);
str[0] = (bitmask4 << 4) | ((codepoint >> 18) & bitmask3);
str[1] = bit8 | ((codepoint >> 12) & bitmask6);
str[2] = bit8 | ((codepoint >> 6) & bitmask6);
str[3] = bit8 | ( codepoint & bitmask6);