En- and decoding of characters outside the Basic Multilingual Plane #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
RFC4627 prescribes that everything has to in some Unicode
encoding (which we comply with by using ASCII (UTF-8) and encoding
everything else) and that any character may be escaped. When escaping,
however, we need to take care to only escape characters in the Basic
Multilingual Plane (BMP) which is U+0000 to U+FFFF:
This commit implements en- and decoding of UTF-16 surrogate pairs and
the necessary error handling logic required by the ordering requirements
and the fact that a lone surrogate code unit/point may never be decoded
nor encoded.
Test cases partially taken from #3.
BREAKING CHANGES:
Note that the broken behavior can all be considered a bug insofar as it
violates the JSON spec.
UTF-16 surrogate pair.
Unicode codepoint.
*use-strict-json-rules*
encoding a surrogate codepoint ordecoding a lone surrogate code unit will result in an error.
If
*use-strict-json-rules*
is NIL, it'll behave as before.Overall this does the same as #3, but
*use-strict-json-rules*
.read-json-string-char
is unchanged, instead the surrogate decoding logic is handleddecode-json-string
.