-
-
Notifications
You must be signed in to change notification settings - Fork 773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dumper.js, why my emojis are escaped ? #587
Labels
Comments
ysavary
pushed a commit
to amplifysa/js-yaml
that referenced
this issue
Nov 20, 2020
ysavary
pushed a commit
to amplifysa/js-yaml
that referenced
this issue
Nov 20, 2020
Closed
This was referenced Mar 11, 2021
This was referenced Mar 18, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi all,
The yaml specification says (https://yaml.org/spec/1.2/spec.html#id2770814):
dumper.js follow the specification:
js-yaml/lib/js-yaml/dumper.js
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.
js-yaml/lib/js-yaml/dumper.js
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.The text was updated successfully, but these errors were encountered: