Defect in haxe.Json (Haxe 2.10)

39 views
Skip to first unread message

Rocks Wang

unread,
Feb 18, 2013, 11:19:30 PM2/18/13
to haxe...@googlegroups.com
Don't know if it's already fixed in newer version.

Symptom: Json.parse() doesn't work if the input string contains Chinese characters (UTF-8 encoded)
Fix:
At line 319 ~ 324:
    #if (neko || php || cpp)
    // ensure utf8 chars are not cut
    else if( c >= 0x80 ) {
        pos++;
        if( c >= 0xE0 ) pos += 1 + (c & 32);
    }
Change to:
    #if (neko || php || cpp)
    // ensure utf8 chars are not cut
    else if( c >= 0x80 ) {
        pos += 1 + ((c & 32) >> 5);
    }

Cambiata

unread,
Feb 19, 2013, 1:41:47 AM2/19/13
to haxe...@googlegroups.com
If you haven't filed an issue on this, I think it's the right thing to do.
http://code.google.com/p/haxe/issues/list

Andreas Mokros

unread,
Feb 19, 2013, 3:47:32 AM2/19/13
to haxe...@googlegroups.com
Hi.

On Mon, 18 Feb 2013 20:19:30 -0800 (PST)
Rocks Wang <rock...@gmail.com> wrote:
> Don't know if it's already fixed in newer version.
> Symptom: Json.parse() doesn't work if the input string contains
> Chinese characters (UTF-8 encoded)

This patch was made:
http://code.google.com/p/haxe/source/diff?spec=svn5724&r=5724&format=side&path=/trunk/std/haxe/Json.hx

Maybe your version is better?

--
Mockey
Reply all
Reply to author
Forward
0 new messages