Skip to content

dump is not escaping non-printable characters #620

Open
@Esaron

Description

@Esaron

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions