Description
apm run start crashes with a UnicodeDecodeError when the .prompt.md file contains any character outside ASCII on a Windows system with a non-UTF-8 locale encoding (CP950, CP936, CP932).
Steps to Reproduce
- Windows machine with a CJK locale (console code page CP950)
apm init my-project && cd my-project
- Edit
start.prompt.md to include any CJK character (e.g. # 開始)
apm run start
Actual Behaviour
[x] Script execution error: 'cp950' codec can't decode byte 0x8b in position 12: illegal multibyte sequence
Expected Behaviour
The prompt file is read as UTF-8 and the command executes successfully.
Root Cause
Three open() calls in script_runner.py do not pass an explicit encoding parameter:
PromptCompiler.compile() — reads the source .prompt.md
PromptCompiler.compile() — writes the compiled output file
ScriptRunner._execute_script() — reads the compiled file
Without encoding="utf-8", Python uses the platform default (CP950 on affected systems), which cannot decode UTF-8 multi-byte sequences.
Environment
- OS: Windows 11, console code page CP950
- apm version: v0.8.11