NEL (U+0085) not escaped during dump, breaks roundtrip
ruamel.yaml is a YAML 1.2 parser/emitter for Python
Brought to you by:
anthon
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.