summaryrefslogtreecommitdiff
path: root/ext/json/utf8_to_utf16.c
diff options
context:
space:
mode:
authorScott MacVicar <scottmac@php.net>2009-01-02 03:02:22 +0000
committerScott MacVicar <scottmac@php.net>2009-01-02 03:02:22 +0000
commit0bdbc4e356d81fd2fd7e1f2391e24e76c2f3b8f6 (patch)
treeb62b4615b40808b430f3b0c8f69fbe5aa416c3b3 /ext/json/utf8_to_utf16.c
parent8d62f3dd0201094f589fa8c64ab337e5edcf43e6 (diff)
downloadphp-git-0bdbc4e356d81fd2fd7e1f2391e24e76c2f3b8f6.tar.gz
MFH Fix bug #46944 - UTF-8 characters outside the BMP aren't encoded correctly.
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));