Skip to content

tools: run child lifters with -X utf8 and decode subprocess output with replace error handler - #1

Closed
ESp3cter wants to merge 1 commit into
rigaz29:gowafrom
ESp3cter:fix/utf8-subprocesses
Closed

ESp3cter wants to merge 1 commit into
rigaz29:gowafrom
ESp3cter:fix/utf8-subprocesses

Conversation

@ESp3cter

Copy link
Copy Markdown

Resolves rigaz29/Ascension-R#41.

Problem

When building on Windows where the user profile directory contains accented or non-ASCII characters (e.g. \C:\Users\Usuário...), child Python processes spawned via \sys.executable\ without explicit UTF-8 flags default to the system's ANSI code page (cp1252 in PT-BR, Western European languages, etc.).

When the parent process runs with -X utf8\ (as in Ascension-R's Kit / \gowa.py), \subprocess.run(..., capture_output=True, text=True)\ uses Python's internal _readerthread\ configured for UTF-8 decoding. When the child process outputs byte \

…error handler

When a user's Windows profile directory contains non-ASCII characters (e.g. C:\Users\Usuário), child Python processes spawned via sys.executable default to the ANSI code page (cp1252) rather than UTF-8. Under -X utf8 in parent runners, subprocess.run(text=True) reader threads encountered UnicodeDecodeError on byte 0xe1, resulting in None stdout and crashes in splitlines() and string concatenation.

Explicitly pass -X utf8 to child lifter invocations, decode subprocess output with encoding='utf-8' and errors='replace', and add UTF-8 encoding declarations to manifest and registration file I/O.
@rigaz29

rigaz29 commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Thanks a lot, @ESp3cter, and sorry for the overlap: I only saw this PR after pushing the same fix to gowa in 9c48171. It starts the lifter in the tool's own mode (-X utf8 when the tool runs with it) and reads what it prints with errors="replace". The tests of the three tools now run in a folder with accents under PYTHONUTF8=0, so they fail without the fix on any Python, and the Kit's check before each release builds in such a folder too (rigaz29/Ascension-R@9869dfb). Since gowa has all of that, I'm closing this one. Thanks for tracking it down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants