GNOME Bugzilla – Bug 730425
control chars in strings are escaped incorrectly
Last modified: 2014-05-21 13:58:11 UTC
For a string containing a ESC character, say, JsonGenerator produces the output "\033". This is not legal JSON, which only allows "\u001b".
Using g_strescape() is wrong in JsonGenerator. It does everything wrong except for \b \t \n \" \\ \r \f.
Created attachment 276827 [details] [review] generator: Escape the control characters correctly Escaping these as octals is out of the JSON spec completely, so roll our own string encoder.
Review of attachment 276827 [details] [review]: thanks for looking into this; the patch looks good, but it would be great to have a proper unit for the Generator test suite as well.
Created attachment 276924 [details] [review] generator: Add tests for updated string escaping routine
Comment on attachment 276827 [details] [review] generator: Escape the control characters correctly Attachment 276827 [details] pushed as f2ee9a7 - generator: Escape the control characters correctly
Review of attachment 276924 [details] [review]: looks great, thanks!
Attachment 276924 [details] pushed as 8bbc873 - generator: Add tests for updated string escaping routine