Closed guidotex closed 3 years ago
So I finally got time to look at this - and this is sorta by design - basically when I parse the \u012b
character, json.h is turning it into the actual unicode character that that represents. This is a difficult problem unfortunately - because people wanted me to turn \n into the actual newline character, it made sense to do the same with \u. But it would be perfectly valid to have ī\u012b in a string, and then I'd either have to turn it into \u012b\u012b or īī!
That makes complete sense. :)
In the example program, the {"key2", "value2"} pair has an escape in front of the \u, so it is coded specifically as "\u012b".
Would there be any undesirable results from looking for the double escape before '\u' to recognize this as string rather than a character?
Your thoughts?
I don't think there is anything I can do for this one (sorry for the delay, COVID got in the way).
Thanks for the interest in my library!
I've been using your library for a while - very nice. Thank you for the effort to build it! I recently ran into an odd JSON string with a unicode value that looks like valid json to me (based on description of strings at www.json.org). 'json.c' parses it without error, but prints garbage due to the escape character (see program below for test case).
I ran this string through my vim json parser: PASS and pretty_prints correctly I ran it through the parser at jsonlint.org: PASS and pretty_prints correctly I run it through json.c: PASS... but it won't print correctly
Compiling on Ubuntu 12.04, g++ version 4.6.4
I think the solution is how to handle the escape character in 'json_parse_string()'...
I'm stumped!