fix(tools): decode gh and git output as UTF-8 in pr_overlap #1990

Closed
MGXAe wants to merge 1 commit from upstream-pr/1990 into main
MGXAe commented 2026-10-09 03:51:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MGXAe on 2026-10-09T03:51:17Z.


What

Fixes #1949. tools/pr_overlap.py decoded gh and git output with the process locale, so on Windows a non-ASCII character in a PR body crashed it. It now decodes as UTF-8 and writes the report files as UTF-8.

Tested

Windows 11, Python 3.14.3 (cp1252): python tools/pr_overlap.py --branch HEAD --repo boykopovar/AnyPS5 crashes on main with the TypeError from the issue and exits 0 with this change. --out also exits 0. tools/check_conventions.py passes.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4795745890 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1990). Originally posted by [MGXAe](https://github.com/MGXAe) on 2026-10-09T03:51:17Z. --- ### What Fixes #1949. `tools/pr_overlap.py` decoded `gh` and `git` output with the process locale, so on Windows a non-ASCII character in a PR body crashed it. It now decodes as UTF-8 and writes the report files as UTF-8. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. --> Windows 11, Python 3.14.3 (cp1252): `python tools/pr_overlap.py --branch HEAD --repo boykopovar/AnyPS5` crashes on `main` with the `TypeError` from the issue and exits 0 with this change. `--out` also exits 0. `tools/check_conventions.py` passes. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
MarcZX10 commented 2026-10-09 03:54:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T03:54:34Z.

Review: COMMENTED


This overlaps with the earlier #1989, which already adds explicit UTF-8 decoding for gh, git, and merge-tree, plus registered regression tests simulating a cp1252 decoder. Your write_text(encoding="utf-8") addition is useful and in scope because decoded Unicode can also fail when the report is written on Windows. Please coordinate with #1989’s author to consolidate the fix and its tests in one PR (or make the remaining report-writing behavior an explicitly separate follow-up if they decline). The current head’s Windows/Linux jobs are still running.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5465539006 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1990#pullrequestreview-5465539006). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-09T03:54:34Z. **Review:** COMMENTED --- This overlaps with the earlier #1989, which already adds explicit UTF-8 decoding for `gh`, `git`, and `merge-tree`, plus registered regression tests simulating a cp1252 decoder. Your `write_text(encoding="utf-8")` addition is useful and in scope because decoded Unicode can also fail when the report is written on Windows. Please coordinate with #1989’s author to consolidate the fix and its tests in one PR (or make the remaining report-writing behavior an explicitly separate follow-up if they decline). The current head’s Windows/Linux jobs are still running.
MGXAe commented 2026-10-09 03:56:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MGXAe on 2026-10-09T03:56:13Z.


Agreed, #1989 covers the decoding fix and has the tests. Closing this as a duplicate. Once #1989 merges I will open a small follow-up for the report-writing line (write_text with encoding utf-8).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6073946281 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1990#issuecomment-6073946281). Originally posted by [MGXAe](https://github.com/MGXAe) on 2026-10-09T03:56:13Z. --- Agreed, #1989 covers the decoding fix and has the tests. Closing this as a duplicate. Once #1989 merges I will open a small follow-up for the report-writing line (write_text with encoding utf-8).

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!1990
No description provided.