skill-creator quick_validate.py crashes reading non-ASCII SKILL.md under non-UTF-8 locale

Open 💬 1 comment Opened Aug 27, 2026 by xu-kai-quan
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

Description

Same root cause as the plugin-creator sample script (see #41026): codex-rs/skills/src/assets/samples/skill-creator/scripts/quick_validate.py reads SKILL.md without an explicit encoding:

content = skill_md.read_text()

Path.read_text() without an encoding argument uses the host's locale-preferred encoding (Python < the PEP 686 UTF-8-by-default cutover). On a non-UTF-8-locale Windows install (Chinese/Japanese/Korean Windows commonly default to cp936/cp932/cp949), a SKILL.md saved as UTF-8 by literally any normal editor (VS Code, the GitHub web editor, etc.) will fail to decode as soon as it contains any non-ASCII character — an accented name, an em dash, a smart quote pasted from a word processor, or non-English text in the description, all of which are completely ordinary in hand-authored documentation.

Steps to reproduce

from pathlib import Path
import tempfile
import quick_validate

skill_dir = Path(tempfile.mkdtemp())
(skill_dir / "SKILL.md").write_text(
    "---\n"
    "name: cafe-helper\n"
    "description: Helps with caf\u00e9 orders \u2014 handles \u2019smart\u2019 quotes\n"
    "---\n\nBody text.\n",
    encoding="utf-8",
)
quick_validate.validate_skill(skill_dir)

On a machine whose locale encoding is cp936:

UnicodeDecodeError: 'gbk' codec can't decode byte 0x94 in position 76: illegal multibyte sequence

Expected behavior

Validating a normal, UTF-8-encoded SKILL.md with any non-ASCII punctuation or text should work regardless of the host's locale.

Actual behavior

UnicodeDecodeError on non-UTF-8-locale systems.

Environment

  • Commit: 7c37479 (main, 2026-08-27), Python 3.14, Windows 11, locale cp936
  • File: codex-rs/skills/src/assets/samples/skill-creator/scripts/quick_validate.py:23
  • Note: there is no existing test file for this script (codex-rs/skills/tests/ has no test_skill_creator.py or equivalent).

Suggested fix

-    content = skill_md.read_text()
+    content = skill_md.read_text(encoding="utf-8")

View original on GitHub ↗

1 Comment

github-actions[bot] contributor · 1 day ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #41026

Powered by Codex Action