scottmac                Thu Feb 12 00:15:46 2009 UTC

  Added files:                 (Branch: PHP_5_2)
    /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.
  
  Forgot to merge this back in January
  
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/json/utf8_decode.c?r1=1.1&r2=1.1.2.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.2.1
--- php-src/ext/json/utf8_decode.c:1.1  Tue Jan 31 08:59:06 2006
+++ php-src/ext/json/utf8_decode.c      Thu Feb 12 00:15:45 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.2.1&r2=1.1.2.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.2.1 
php-src/ext/json/utf8_to_utf16.c:1.1.2.2
--- php-src/ext/json/utf8_to_utf16.c:1.1.2.1    Thu Aug 21 18:10:48 2008
+++ php-src/ext/json/utf8_to_utf16.c    Thu Feb 12 00:15:45 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

Reply via email to