Menu

#565 NEL (U+0085) not escaped during dump, breaks roundtrip

open
nobody
None
minor
bug
2026-03-15
2026-03-15
No

NEL (U+0085) is emitted as a literal byte in quoted strings instead of being escaped. On load, it’s treated as whitespace and collapses to a space, breaking roundtrip.

from ruamel.yaml import YAML
from io import StringIO

ry = YAML(typ="safe")
data = {"\x85": None}
stream = StringIO()
ry.dump(data, stream=stream)
dumped = stream.getvalue()
# "{? '\x85' : null}\n" — NEL not escaped

loaded = ry.load(dumped)
# {' ': None} — NEL collapsed to space
assert data == loaded  # fails

PyYAML escapes it as "\N" and roundtrips correctly.

Affects all modes (safe, rt, unsafe). Tested with ruamel.yaml 0.19.1.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB