Skip to content

fix(compose): error on non-printable characters in scalar values - #737

Open
monebzz wants to merge 6 commits into
eemeli:mainfrom
monebzz:fix/non-printable-scalar-error
Open

monebzz wants to merge 6 commits into
eemeli:mainfrom
monebzz:fix/non-printable-scalar-error

Conversation

@monebzz

@monebzz monebzz commented Oct 22, 2026

Copy link
Copy Markdown

Issue

Fixes #703

LLM Use

As discussed on the issue: an LLM assistant helped draft the code and tests. The changes were reviewed against the YAML spec's c-printable rule and the codebase's own behaviour, and the full test suite passes (3,417 tests, including 4 new ones for this fix).

Description

The parser silently accepted non-printable control characters that the YAML spec excludes. This adds a check during composition, in resolveFlowScalar() and resolveBlockScalar() as suggested on the issue, reporting an UNEXPECTED_TOKEN error for scalar values containing them.

  • Double-quoted scalars only flag unescaped control characters — escape sequences like "\u0001" are legal YAML and still parse cleanly
  • U+FFFE/U+FFFF are not flagged, matching what the library's own stringifier emits
  • Parse side only; the stringify side mentioned on the issue is left as a follow-up

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No error for C0-control characters

1 participant