Commit 84d0401
fix: add encoding="utf-8" to prompt file open() calls in script_runner (Windows CP950) (#607)
PromptCompiler.compile() and _resolve_prompt_file() open .prompt.md files
with plain open() which defaults to the system locale encoding. On Windows
systems set to CP950/CP936/CP932 (Chinese/Japanese/Korean), a UTF-8 encoded
prompt file containing any multibyte character causes:
UnicodeDecodeError: 'cp950' codec can't decode byte 0x8b in position 12
Three open() calls were missing explicit encoding:
- compiled_path read in ScriptRunner._execute_script
- prompt_path read in PromptCompiler.compile
- output_path write in PromptCompiler.compile
Adding encoding="utf-8" to all three matches the behaviour of the rest of
the codebase and fixes the crash for any non-UTF-8 Windows locale.
Co-authored-by: Sergio Sisternes <sergio_sisternes@epam.com>1 parent 40621bf commit 84d0401
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
259 | | - | |
| 259 | + | |
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
| |||
916 | 916 | | |
917 | 917 | | |
918 | 918 | | |
919 | | - | |
| 919 | + | |
920 | 920 | | |
921 | 921 | | |
922 | 922 | | |
| |||
939 | 939 | | |
940 | 940 | | |
941 | 941 | | |
942 | | - | |
| 942 | + | |
943 | 943 | | |
944 | 944 | | |
945 | 945 | | |
| |||
0 commit comments