fix: add explicit UTF-8 encoding to all subprocess text=True calls (#53428)

On Windows with Chinese locale (GBK), subprocess.run(text=True) without
explicit encoding causes UnicodeDecodeError crashes. This fix adds
encoding='utf-8', errors='replace' to all subprocess.run() and
subprocess.Popen() calls that use text=True across 76 non-test Python files.

Fixes #53428 (master tracker for Windows GBK locale crash).

Note: credential_pool.py and electron changes excluded per reviewer request —
those will be submitted as separate focused PRs.
This commit is contained in:
Stoltemberg
2026-06-29 23:42:46 -03:00
committed by Teknium
parent d460118a1d
commit c89481db5e
61 changed files with 161 additions and 161 deletions
+1 -1
View File
@@ -147,7 +147,7 @@ def _try_gh_cli_token() -> Optional[str]:
result = subprocess.run(
cmd,
capture_output=True,
text=True,
text=True, encoding='utf-8', errors='replace',
timeout=5,
env=clean_env,
**_popen_kwargs,