Ways to detect that XXXX in JSON \uXXXX does not correspond to a Unicode character?
daniel.buenzli at erratique.ch
Thu May 7 20:22:01 CDT 2015
Le vendredi, 8 mai 2015 à 02:16, Philippe Verdy a écrit :
I suggest you have a careful read at RFC 7159 as it specifically implies that this is not the model it supports (albeit using broken or let's say ambiguous/imprecise Unicode terminology).
> Then the JSON processor will decode this text and will remap it to an internal UTF-16 encoding (for characters that are not escaped) and the "\uXXXX" will be decoded as plain 16-bit code units. The result will be a stream of 16-bit code units, which can then externally be outpout and encoded or stored in any convenient encoding that preserves this stream, EVEN if this is not valid UTF-16.
I don't know where you get this from but you won't find any mention of this in the standard. We are dealing with text, Unicode scalar values, not encodings. At the risk of repeating myself, read section 8.2 of RFC 7159.
More information about the Unicode