scottmac Fri Jan 2 03:02:22 2009 UTC
Added files: (Branch: PHP_5_3)
/php-src/ext/json/tests bug46944.phpt
Modified files:
/php-src/ext/json utf8_decode.c utf8_to_utf16.c
Log:
MFH Fix bug #46944 - UTF-8 characters outside the BMP aren't encoded
correctly.
http://cvs.php.net/viewvc.cgi/php-src/ext/json/utf8_decode.c?r1=1.1&r2=1.1.4.1&diff_format=u
Index: php-src/ext/json/utf8_decode.c
diff -u php-src/ext/json/utf8_decode.c:1.1
php-src/ext/json/utf8_decode.c:1.1.4.1
--- php-src/ext/json/utf8_decode.c:1.1 Tue Jan 31 08:59:06 2006
+++ php-src/ext/json/utf8_decode.c Fri Jan 2 03:02:22 2009
@@ -165,7 +165,7 @@
/*
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);
http://cvs.php.net/viewvc.cgi/php-src/ext/json/utf8_to_utf16.c?r1=1.1.4.1&r2=1.1.4.2&diff_format=u
Index: php-src/ext/json/utf8_to_utf16.c
diff -u php-src/ext/json/utf8_to_utf16.c:1.1.4.1
php-src/ext/json/utf8_to_utf16.c:1.1.4.2
--- php-src/ext/json/utf8_to_utf16.c:1.1.4.1 Wed Jan 30 03:17:57 2008
+++ php-src/ext/json/utf8_to_utf16.c Fri Jan 2 03:02:22 2009
@@ -46,7 +46,7 @@
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));
http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/bug46944.phpt?view=markup&rev=1.1
Index: php-src/ext/json/tests/bug46944.phpt
+++ php-src/ext/json/tests/bug46944.phpt
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php