summaryrefslogtreecommitdiff
path: root/src/runtime/c
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/c')
-rw-r--r--src/runtime/c/gu/utf8.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/runtime/c/gu/utf8.c b/src/runtime/c/gu/utf8.c
index d0bd89b90..70db65f05 100644
--- a/src/runtime/c/gu/utf8.c
+++ b/src/runtime/c/gu/utf8.c
@@ -11,9 +11,12 @@ gu_utf8_decode(const uint8_t** src_inout)
return (GuUCS) c;
}
size_t len = (c < 0xe0 ? 1 :
- c < 0xf0 ? 2 :
- 3);
- uint32_t mask = 0x07071f7f;
+ c < 0xf0 ? 2 :
+ c < 0xf8 ? 3 :
+ c < 0xfc ? 4 :
+ 5
+ );
+ uint64_t mask = 0x0103070F1f7f;
uint32_t u = c & (mask >> (len * 8));
for (size_t i = 1; i <= len; i++) {
c = src[i];