ruby / ruby/psych

dump is not escaping non-printable characters

Open
#620 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
597
Forks
223
Avg merge
11h 23m
Merged PRs (30d)
3

Description

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"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no source file or test. Start with the Psych.load/Psych.dump reproduction shown here and trace the dumping path for the non-breaking space; done means the round trip emits the YAML escape "\_" instead of a literal non-breaking space.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.