fix(forge): pr view and the other commands print UTF-8 into a pipe, so Windows doesn't stop on an emoji #120
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!120
Loading…
Reference in a new issue
No description provided.
Delete branch "d4nkn3ss/Longshot:fix/forge-unicode-output"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
On Windows,
forge.py pr view(and any command printing a PR's or issue's text) stops with aUnicodeEncodeErrorwhen its output goes into a pipe, as it does for agents: the template's own "Δ" is enough to trigger it.What changed
unicode_output()inscripts/forge.py, called first inmain(), the same asteam_chat.py's. With-I, Python ignoresPYTHONIOENCODING, so a pipe on Windows gets cp1252. Now a pipe gets UTF-8, a console keeps its own encoding, and a character it can't show is replaced instead of ending the command.test_view_into_a_cp1252_pipeintests/test_forge_pr.pyviews a PR into a cp1252 pipe, astest_team_chat.pydoes forread.Flags and settings
None
Measurements
main:
94bbc205(2026-11-12)this PR: fix/forge-unicode-output @
fce11343Hardware: Windows 11, Python 3.12 from python.org
Scene: n/a (game-free)
Method: the new test on both sides (forge.py from main with this PR's test), and
python -I scripts/forge.py pr view 80 | headin Git BashHow to reproduce: on Windows,
python -I scripts/forge.py pr view <a PR whose description has an emoji or a Δ> | more94bbc205fce11343test_view_into_a_cp1252_pipeUnicodeEncodeError: 'charmap' codec can't encode character '\u0394'tests/test_forge_pr.py: 21 tests)forge.py pr view 80, pipedcp1252.py, nothing printedTesting
Tested: both rows above on Windows 11.
Full suite:
python -I -B tests/run_all.pyon this branch @fce11343, Windows 11: 493 passed, 3 failed, 35 skipped. The failures:tests/test_check_third_party.py(#80),tests/test_setup_runtime.py(#118) andtests/test_release.py(#119), all failing onmainthe same way.Not tested: Linux and macOS: their pipes are UTF-8 already, so the reconfigure changes nothing there; the new test forces cp1252, so it checks the fix on every OS.
Needs other testers: None
Screenshots
Nothing on screen
Risk and rollback
Only the encoding of forge.py's own output changes; reverting the commit is enough.
Issues
None
Checklist
For everyone
type(scope): description).main.python -I -B tests/run_all.pyrun and passing (any failure that also fails onmainis named above).third_party/untouched (a new folder with aPROVENANCE.mdinstead).If applicable
Assisted-by:/Co-Authored-By:trailers.mainand passing here.tests/that reads changed source updated in this PR, not weakened. (tests/test_forge_pr.pygainstest_view_into_a_cp1252_pipe; nothing removed.)🤖 Generated with Claude Code
Full game-free suite run on this branch (Windows 11); the results and the failures that also fail on main are now under Testing. Marking ready.
WIP: fix(forge): pr view and the other commands print UTF-8 into a pipe, so Windows doesn't stop on an emojito fix(forge): pr view and the other commands print UTF-8 into a pipe, so Windows doesn't stop on an emojiApproved
fce11343after inspecting the 15-line production change and running independent native Windows Python 3.14.7 checks.The existing test_forge_pr.py group passes. A separate no-network harness exercises the actual main() with a mocked issue API and four stream cases: cp1252 stdout pipe, cp1252 stderr pipe on an argparse error, cp1252 tty-like console, and StringIO. Text includes Delta, a robot and CJK. Two interleaved main
d906c8f4/ PR pairs give 3 failing cases of 4 on main versus 0 of 4 on the PR each time (median failures 3 -> 0). The pipe retains the Unicode text as UTF-8; the console keeps cp1252 with replacement; StringIO remains supported.The branch also merges cleanly into fetched main
514591a3. I extracted that merge-tree's forge.py without changing a checkout and ran the same no-network stream probes against it: all 8 case-runs pass. This separately checks the small entry-point change with the newer authentication/comment-upload code.No blocking findings. I did not repeat the entire Longshot suite, invoke real credential commands or claim a real-console rendering test. Please add the two independent pairs to Measurements when updating the description; they supply the repeated correctness evidence its checklist asks for.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.