Skip to content

fix(bundler): dump_yaml writes literal UTF-8 (allow_unicode=True)#3660

Open
jawwad-ali wants to merge 1 commit into
github:mainfrom
jawwad-ali:fix/bundler-yamlio-allow-unicode
Open

fix(bundler): dump_yaml writes literal UTF-8 (allow_unicode=True)#3660
jawwad-ali wants to merge 1 commit into
github:mainfrom
jawwad-ali:fix/bundler-yamlio-allow-unicode

Conversation

@jawwad-ali

Copy link
Copy Markdown
Contributor

What

dump_yaml (bundler/lib/yamlio.py) called yaml.safe_dump without allow_unicode=True, so any non-ASCII content was written as \xNN / \uXXXX escape sequences instead of literal UTF-8 — e.g. café-münchen became "caf\xE9-m\xFCnchen" in the file. That's a round-trip readability loss for any bundle config carrying accented or non-Latin text.

Why it matters

The centralized frontmatter helper _utils.dump_frontmatter explicitly passes allow_unicode=True and documents it so "no call site can silently drop" unicode, and the extensions/presets config writers (extensions/_commands.py, presets/_commands.py) all do the same. dump_yaml was the outlier.

Fix

Add allow_unicode=True to the safe_dump call, matching the sibling writers.

Tests

tests/unit/test_bundler_yamlio.py:

  • test_dump_yaml_preserves_unicode — asserts literal café-münchen / 例え in the output and no \x/\u escapes (fails before the fix)
  • test_dump_yaml_round_trips_unicodeload_yaml(dump_yaml(...)) round-trips

ruff clean.


AI-assisted: authored with Claude Code. Verified against the dump_frontmatter / extensions / presets sibling writers and confirmed fail-before/pass-after.

dump_yaml called yaml.safe_dump without allow_unicode=True, so non-ASCII
content was written as \xNN / \uXXXX escapes instead of literal UTF-8 — a
round-trip readability loss for bundle config. The centralized helper
_utils.dump_frontmatter and the extensions/presets config writers all pass
allow_unicode=True; align dump_yaml with them.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jawwad-ali
jawwad-ali requested a review from mnriem as a code owner July 22, 2026 16:48
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