scottmac                Fri Jan  2 03:01:54 2009 UTC

  Modified files:              
    /php-src/ext/json   utf8_decode.c utf8_to_utf16.c 
  Log:
  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.2&r2=1.3&diff_format=u
Index: php-src/ext/json/utf8_decode.c
diff -u php-src/ext/json/utf8_decode.c:1.2 php-src/ext/json/utf8_decode.c:1.3
--- php-src/ext/json/utf8_decode.c:1.2  Thu Jul 12 09:55:41 2007
+++ php-src/ext/json/utf8_decode.c      Fri Jan  2 03:01:53 2009
@@ -159,7 +159,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.3&r2=1.4&diff_format=u
Index: php-src/ext/json/utf8_to_utf16.c
diff -u php-src/ext/json/utf8_to_utf16.c:1.3 
php-src/ext/json/utf8_to_utf16.c:1.4
--- php-src/ext/json/utf8_to_utf16.c:1.3        Wed Jan 30 03:21:30 2008
+++ php-src/ext/json/utf8_to_utf16.c    Fri Jan  2 03:01:53 2009
@@ -45,7 +45,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));



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to