summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix von Leitner <felix-libowfat@fefe.de>2018-02-02 17:43:25 +0000
committerFelix von Leitner <felix-libowfat@fefe.de>2018-02-02 17:43:25 +0000
commit707f0cca3b0906240758c42ba3f49bb1836d4989 (patch)
treee2a2d5a39357a6726efc1c99220bdcb5e897b498
parent20db301e4f511de4fab202687bc418d65c99cce5 (diff)
downloadlibowfat-707f0cca3b0906240758c42ba3f49bb1836d4989.tar.gz
libowfat-707f0cca3b0906240758c42ba3f49bb1836d4989.zip
zero-terminate utf8 strings in ent
-rw-r--r--ent.c1
-rw-r--r--t.c2
2 files changed, 2 insertions, 1 deletions
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