From 8762353535f17ca113c56b6e595a6489a99b0c33 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 30 Sep 2026 19:32:38 +0000 Subject: [PATCH] Fix Windows cp1252 encoding bugs in build_all_github.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First real run (v1.7.3.3, test pre-release) surfaced two bugs, both the same root cause: Windows' default console/subprocess encoding is cp1252, not UTF-8 — build_all.py's own _Tee already works around this for its output, build_all_github.py didn't. 1. `git log -1 --pretty=%B` was decoded with subprocess's platform default (cp1252) instead of UTF-8, mangling non-ASCII characters (em-dashes -> "—") in the commit-message-derived release notes — the actual release body v1.7.3.3 shipped with. Added encoding="utf-8" to the subprocess.run() call. 2. The final success print() (uses a ✓) crashed with UnicodeEncodeError on the Windows console after build_all.main() had already restored the real stdout/stderr — cosmetic (the Release + all 4 assets were already published successfully by that point) but made the job report red for a fully successful run. Reconfigures stdout/stderr to UTF-8 with errors="replace" at module load, covering every print() in this file. v1.7.3.3's pre-release (garbled body, otherwise correct) was deleted manually — this fix is for the next real run. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01JYLx9STTgfo9KXLC2Gog3g --- src/compiler/build_all_github.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/compiler/build_all_github.py b/src/compiler/build_all_github.py index 75f9b05..3a06624 100644 --- a/src/compiler/build_all_github.py +++ b/src/compiler/build_all_github.py @@ -34,6 +34,14 @@ os.environ.setdefault("GLA_BUILD_VENV_DIR", r"D:\_gla_ci_venv") +# Windows' console/subprocess default encoding is cp1252, not UTF-8 — same +# class of problem build_all.py's own _Tee already works around for ITS +# output. Reconfiguring here covers every print() in this module (e.g. the +# ✓ below) that runs after build_all.main() has restored the real +# stdout/stderr streams. +sys.stdout.reconfigure(encoding="utf-8", errors="replace") +sys.stderr.reconfigure(encoding="utf-8", errors="replace") + import requests import build_all @@ -65,6 +73,7 @@ def _release_notes() -> str: result = subprocess.run( ["git", "log", "-1", "--pretty=%B"], cwd=str(_root.parent), capture_output=True, text=True, check=True, + encoding="utf-8", ) return result.stdout.strip()