Skip to content
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

dump is not escaping non-printable characters #620

Open
Esaron opened this issue Feb 17, 2023 · 0 comments
Open

dump is not escaping non-printable characters #620

Esaron opened this issue Feb 17, 2023 · 0 comments

Comments

@Esaron
Copy link

Esaron commented Feb 17, 2023

I have some YAML with some values containing non-breaking spaces, correctly formatted according to the YAML spec's guidelines on escaped characters as "\_". Psych correctly loads these strings and converts them to non-breaking space characters (\u00A0). The issue is that when dumping back to YAML, Psych does not correctly escape these non-printable characters as specified by the spec.

Example

Expected

irb(main):002:0> Psych.dump(Psych.load('"\\_"'))
=> "--- \"\\_\"\n"

Actual

irb(main):002:0> Psych.dump(Psych.load('"\\_"'))
=> "--- \" \"\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant