Description
Hi all,
The yaml specification says (https://yaml.org/spec/1.2/spec.html#id2770814):
On output, a YAML processor must only produce acceptable characters. Any excluded characters must be presented using escape sequences. In addition, any allowed characters known to be non-printable should also be escaped. This isn’t mandatory since a full implementation would require extensive character property tables.
c-printable ::= #x9 | #xA | #xD | [#x20-#x7E] /* 8 bit */
| #x85 | [#xA0-#xD7FF] | [#xE000-#xFFFD] /* 16 bit */
| [#x10000-#x10FFFF] /* 32 bit */
dumper.js follow the specification:
Lines 186 to 191 in d8ba402
But the code that is calling isPrintable() use charCodeAt. This function will never return char > 0xFFFF so the supplementary planes range (0x010000 to 0x10FFFF) which include emojis will never be detected as printable.
Lines 289 to 293 in d8ba402
I tested with codePointAt and Array.from(string)
to iterate the chars while managing surrogate pairs: emojis are not escaped as desired.