skill-creator: read_text()/write_text() sem encoding=utf-8 corrompem conteúdo acentuado no Windows

Open 💬 0 comments Opened Jul 12, 2026 by jeanfamulli

Problem

Several scripts in the built-in skill-creator skill (and its eval-viewer sub-tool) call
Path.read_text() / Path.write_text() / open() without an explicit encoding="utf-8".

On Windows, Python's default text encoding falls back to the process locale (commonly cp1252),
not UTF-8. Any file containing non-ASCII characters (e.g. accented text in Portuguese, Spanish,
French reports/skill content) gets mis-decoded on read or mis-encoded on write, silently
corrupting the generated HTML/JSON output.

Affected files (skill-creator)

  • eval-viewer/generate_review.py — read_text()/write_text() calls around lines 94, 107, 134,

156, 225, 258, 339, 369, 427, 434 (already patched locally, see below)

  • scripts/aggregate_benchmark.pyopen(metadata_path), open(grading_file),

open(timing_file), open(output_json, "w"), open(output_md, "w")

  • scripts/generate_report.pyPath(args.input).read_text(),

Path(args.output).write_text(html_output)

  • scripts/improve_description.pylog_file.write_text(...),

Path(args.eval_results).read_text(), Path(args.history).read_text()

  • scripts/quick_validate.pyskill_md.read_text()
  • scripts/run_eval.pycommand_file.write_text(...), Path(args.eval_set).read_text()
  • scripts/run_loop.py — multiple .write_text(...) and .read_text() calls
  • scripts/utils.py(skill_path / "SKILL.md").read_text()

Suggested fix

Add encoding="utf-8" to every read_text() / write_text() call, and encoding="utf-8" to
every open() call that handles text, across all the files above. This is a one-line change per
call site with no behavior change on non-Windows platforms.

Repro

On a Windows machine with a non-UTF-8 system locale (e.g. cp1252, common on pt-BR/es/fr
installs), run the skill-creator eval workflow on any workspace containing accented text
(Portuguese report, etc.) and inspect the generated static HTML — accented characters are
mangled.

View original on GitHub ↗