sheredom / json.h

🗄️ single header json parser for C and C++
The Unlicense
698 stars 77 forks source link

Support for escaped chars in U+1xxxx range. #60

Closed xxxbxxx closed 5 years ago

xxxbxxx commented 5 years ago

using the utf-16 surrogate pairs

xxxbxxx commented 5 years ago

hi!

No, indeed, this is not about supporting utf-16, but dealing with this case:

To escape an extended character that is not in the Basic Multilingual Plane, the character is represented as a twelve-character sequence, encoding the UTF-16 surrogate pair. So, for example, a string containing only the G clef character (U+1D11E) may be represented as "\uD834\uDD1E".

https://tools.ietf.org/id/draft-ietf-json-rfc4627bis-09.html#rfc.section.7

(I not sure there are really any good reasons to want to escape such characters, but some other libraries (like the one in php IIRC), that do this. So the idea was to be able to accept it.)

sheredom commented 5 years ago

Ok cool! If you could fix up the two remaining comments then I'll happily merge this! Thanks for contributing 😄