Discuss unpaired surrogate code points on the why-not-json page

This commit is contained in:
Tony Garnock-Jones 2023-10-17 11:18:50 +02:00
parent 19a4edc36a
commit 0eabbd4257
1 changed files with 7 additions and 0 deletions

View File

@ -97,6 +97,13 @@ Some examples:
- which, if any, of `{"a":1, "a":2}`, `{"a":1}` and `{"a":2}` are the
same? Are all three legal?
- are `{"päron":1}` and `{"päron":1}` the same or different?
- is `"\uD834"` a legal string? Is `"\uDD1E"`?[^unpaired-surrogates]
[^unpaired-surrogates]:
[Section 8.2 of RFC 8259](https://tools.ietf.org/html/rfc8259#section-8.2)
discusses *unpaired UTF-16 surrogate* code points such as these, and
remarks that implementations differ in their treatment of them. Some
reject unpaired surrogates, some discard them, and some retain them.
## JSON can multiply nicely, but it can't add very well