summaryrefslogtreecommitdiff
path: root/ext/json/utf8_to_utf16.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/json/utf8_to_utf16.c')
-rw-r--r--ext/json/utf8_to_utf16.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/json/utf8_to_utf16.c b/ext/json/utf8_to_utf16.c
index 42ea9e5d8e..599f0e13b4 100644
--- a/ext/json/utf8_to_utf16.c
+++ b/ext/json/utf8_to_utf16.c
@@ -46,7 +46,7 @@ utf8_to_utf16(unsigned short w[], char p[], int length)
w[the_index] = (unsigned short)c;
the_index += 1;
} else {
- c &= 0xFFFF;
+ c -= 0x10000;
w[the_index] = (unsigned short)(0xD800 | (c >> 10));
the_index += 1;
w[the_index] = (unsigned short)(0xDC00 | (c & 0x3FF));