zero-terminate utf8 strings in ent

master
leitner 7 years ago
parent ed67042965
commit 112ccf19e7

@ -197,6 +197,7 @@ int main() {
#endif
if (*s==']') break;
} while (*s==',');
(*cur)->utf8[ul]=0;
#if 0
puts("\" },");
#endif

2
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

Loading…
Cancel
Save