Repository navigation
fix(cli): print on a non-UTF-8 Windows console - #16
Merged
Merged
Conversation
Windows pipes inherit the locale code page, so print(__doc__) raised UnicodeEncodeError on the help arrow (U+2192) before it wrote a line. main now reconfigures stdout and stderr to UTF-8 where the stream supports it, which also keeps ensure_ascii=False JSON intact when a title contains non-Latin text. The bare-launcher test is POSIX-only: Windows has no exec bit and CreateProcess cannot run a .py file without a registered association. The portable python3 <skill>/scripts/executor spelling stays the documented, tested form. Bumps the engine to 2.0.3 and syncs the bundle.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The v2.0.2 Windows matrix failed in two places, both caught after the tag:
test_help_lists_the_command_surface:print(__doc__)raisedUnicodeEncodeErrorbecause a Windows pipe inherits cp1252 and the help text contains→.test_the_exec_bit_runs_it_directly: Windows has no exec bit, andCreateProcessrefuses to run a.pyfile directly (WinError 193).Fix
cli.mainreconfigures stdout and stderr to UTF-8 where the stream supports it. Help, error text, andensure_ascii=FalseJSON now survive a redirect under a non-UTF-8 code page; a title with non-Latin text is preserved instead of crashing.python3 <skill>/scripts/executorspelling remains tested everywhere and is what the skills document.Verification
python3 scripts/run_tests.py— 741 tests, 100% branch coveragepython3 scripts/sync_engine.py --check— in syncpython3 scripts/validate_skills.py— cleanpython3 scripts/lint-prompt-injection.py skills/— cleanPYTHONIOENCODING=cp1252 executor --helpexits 0, andnewpreserves a Japanese title in JSONBumps the engine to 2.0.3; the release follows the merge.