Skip to content

fix: Error on non-printable characters in scalar values - #731

Open
dualfroz wants to merge 1 commit into
eemeli:mainfrom
dualfroz:fix/703-c0-control-chars
Open

dualfroz wants to merge 1 commit into
eemeli:mainfrom
dualfroz:fix/703-c0-control-chars

Conversation

@dualfroz

Copy link
Copy Markdown

Issue

fixes #703

LLM Use

an LLM reviewed my code, i didn't apply any of its suggestions

Description

raw non-printable characters in scalars now give a NON_PRINTABLE_CHAR error in doc.errors, checked in resolveFlowScalar() and resolveBlockScalar() as you suggested.

  • plain and block scalars: everything outside c-printable.
  • quoted scalars: only C0, since the spec allows the rest there for JSON compatibility (nb-json). escapes like "\x01" still work.
  • the stringifier now also double-quotes U+FFFE and U+FFFF, otherwise a round trip produced a plain scalar that no longer parses.
  • new error code added to docs/08_errors.md.

tests are in tests/doc/errors.ts, full suite passes.

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