libyaml icon indicating copy to clipboard operation
libyaml copied to clipboard

Support Unicode Surrogate Pairs

Open perlpunk opened this issue 6 years ago • 1 comments

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.

perlpunk avatar Mar 02 '18 17:03 perlpunk

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.

mjambon avatar May 24 '22 03:05 mjambon