Commit 659686a
authored
fix: enable Python UTF-8 mode to fix open() encoding default (#66)
The guest has no locale configured, so CPython defaults all I/O to
ASCII. This causes UnicodeEncodeError when writing non-ASCII characters
via open(path, 'w'). Setting Py_UTF8Mode = 1 before Py_Initialize()
enables UTF-8 mode globally, making stdout/stderr/open() all default
to UTF-8 without needing per-stream reconfigure calls.
Signed-off-by: danbugs <danilochiarlone@gmail.com>1 parent 5198570 commit 659686a
1 file changed
Lines changed: 2 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| 237 | + | |
237 | 238 | | |
238 | 239 | | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | 240 | | |
244 | 241 | | |
245 | | - | |
246 | | - | |
247 | | - | |
| 242 | + | |
248 | 243 | | |
249 | 244 | | |
250 | 245 | | |
| |||
0 commit comments