diff --git a/ent.c b/ent.c index 26c9c8c..8a5aeb6 100644 --- a/ent.c +++ b/ent.c @@ -197,6 +197,7 @@ int main() { #endif if (*s==']') break; } while (*s==','); + (*cur)->utf8[ul]=0; #if 0 puts("\" },"); #endif diff --git a/t.c b/t.c index fd773f5..a3c7ecc 100644 --- a/t.c +++ b/t.c @@ -132,7 +132,7 @@ int main(int argc,char* argv[]) { assert(scan_jsonescape("foo\\u000abar\\\\",buf,&l)==14 && l==8 && byte_equal(buf,8,"foo\nbar\\")); memset(buf,0,sizeof(buf)); /* example from the json spec: G clef U+1D11E encoded using UTF-16 surrogates*/ - assert(scan_jsonescape("\\uD834\\uDD1Exyz",buf,&l)==15 && l==7 && byte_equal(buf,7,"\xf4\x8d\x84\x9exyz")); + assert(scan_jsonescape("\\uD834\\uDD1Exyz",buf,&l)==15 && l==7 && byte_equal(buf,7,"\xf0\x9d\x84\x9exyz")); /* 1D11E -> 0001 1101 0001 0001 1110