You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
json parser: \u escape sequences are not supported #671
The parser rejects any string containing a \uXXXX escape sequence and fails the whole document with a parse error. These escapes are part of the JSON string grammar and are emitted by most JSON producers.
The library's own writer emits them too: control characters are escaped as \u00XX, as required. As a result, output produced by JsonWriter cannot be read back by JsonParser.
Analysis results
Unescaping handles the two-character escapes (\n, \t, \\, …) and returns an error for u. There is no decoding of the four hexadecimal digits and no handling of surrogate pairs.
Two consequences:
Documents from any other producer fail to parse whenever a string uses \u — common for non-ASCII text and for ASCII-safe emitters that escape everything above U+007F.
The write-then-read round trip through this library is broken for any string containing a control character.
Solution
Decode \uXXXX during string parsing: convert the code point to UTF-8, and combine surrogate pairs into a single code point. Reject lone surrogates and malformed sequences as parse errors.
Activity