Skip to content

fix: escape all control characters in TOML basic strings#7

Open
hobostay wants to merge 1 commit into
MoonshotAI:mainfrom
hobostay:fix/toml-escape-control-chars
Open

fix: escape all control characters in TOML basic strings#7
hobostay wants to merge 1 commit into
MoonshotAI:mainfrom
hobostay:fix/toml-escape-control-chars

Conversation

@hobostay
Copy link
Copy Markdown

Summary

  • escapeTomlBasicString only handled \b, \t, \n, \f, \r but not other control characters in U+0000-U+001F and U+007F
  • Per the TOML spec, basic strings may only contain certain escape sequences; unescaped control chars produce invalid TOML that smol-toml cannot parse
  • Now escapes all remaining control characters as \uXXXX sequences

Test plan

  • Verify config saves and loads correctly with normal values
  • Test that strings containing control characters produce valid TOML

🤖 Generated with Claude Code

escapeTomlBasicString only handled \b \t \n \f \r but not other
control characters in U+0000-U+001F and U+007F. Per the TOML spec,
basic strings may only contain certain escape sequences; unescaped
control chars produce invalid TOML that smol-toml cannot parse,
silently corrupting the config on next load.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

1 participant