Skip to content

run_cmd decodes command output with the locale encoding (cp1252 on Windows) #18

Closed

Description

@UnsignedArduino

run_cmd calls subprocess.run(..., capture_output=True, text=True) without encoding=, so output is decoded with the locale's preferred encoding. On Windows with Python 3.14 that's cp1252. (UTF-8 mode only becomes the default in 3.15, per PEP 686.)

Relevant code: utils/run.py, lines 52–54.

npm, Vite and mkc write UTF-8. cp1252 leaves bytes 0x81, 0x8D, 0x8F, 0x90 and 0x9D undefined, so UTF-8 output containing them raises UnicodeDecodeError. That happens when the output is decoded after the process exits, so a command that succeeded is reported as a crash, and a failing command's real output is lost.

Checked by decoding the UTF-8 bytes as cp1252 in Python:

  • ←, ❌, ‐ (U+2010) and 🐉 raise UnicodeDecodeError.
  • ✓ only comes out garbled, which is likely why the Windows CI jobs pass today.

mkc repeats identifiers and string literals from the game's own code in TypeScript errors, so game content can trigger this, not just tool output.

Not reproduced on a Windows machine; this follows from the decoding behavior above.

Expected behavior: decode command output as UTF-8 with errors="replace", matching the earlier fix that made all text file I/O in src/ use encoding="utf-8".

Found while reviewing PR #7, toolchain at ce12c48.

Activity

  1. changed the title [-][P2] run_cmd decodes command output with the locale encoding (cp1252 on Windows)[/-] [+]run_cmd decodes command output with the locale encoding (cp1252 on Windows)[/+] on Nov 4, 2026
  2. added
    found by claudeIssue was originally found by Claude Code. Only used for tracking.
    and removed on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workingfound by claudeIssue was originally found by Claude Code. Only used for tracking.p2

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions