mirror of
https://github.com/php/php-src.git
synced 2025-01-09 20:44:33 +08:00
Fix bug #46944 - UTF-8 characters outside the BMP aren't encoded correctly.
This commit is contained in:
parent
b301ee4c5e
commit
784b59d016
@ -159,7 +159,7 @@ int utf8_decode_next(json_utf8_decode *utf8) /* {{{ */
|
||||
/*
|
||||
Three continuation (65536 to 1114111)
|
||||
*/
|
||||
if ((c & 0xF1) == 0xF0) {
|
||||
if ((c & 0xF8) == 0xF0) {
|
||||
int c1 = cont(utf8);
|
||||
int c2 = cont(utf8);
|
||||
int c3 = cont(utf8);
|
||||
|
@ -45,7 +45,7 @@ int 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));
|
||||
|
Loading…
Reference in New Issue
Block a user