libyaml
libyaml copied to clipboard
Support Unicode Surrogate Pairs
While they are not explicitly mentioned in the YAML 1.1 or 1.2 spec, the following is valid JSON:
{ "unicode": "surrogate pair \ud83d\udcaf" }
Same as
{ "unicode": "surrogate pair 💯" }
Currently libyaml simply rejects such escapes. So it wouldn't hurt to support those escape sequences. js-yaml and SnakeYAML support it, too.
I reported the same issue with a bit more background info in the ocaml-yaml project before realizing that the core YAML parser was implemented here.
A practical use case is some application that takes YAML as input, but what we have is JSON and we expect the JSON to be accepted without reformatting.