Repository navigation
fix(windows): ASCII-only PowerShell scripts — PS 5.1 parse crash (#183, #185) - #192
Merged
Merged
Conversation
Fixes #183. Fixes #185. BOM-less .ps1 files are decoded by Windows PowerShell 5.1 with the system ANSI code page, not UTF-8, so the em-dash (U+2014) and arrow (U+2192) in hunt.ps1 / install.ps1 / install-community-skills.ps1 became 'â€"' and broke parsing — every new PowerShell window threw parser errors and the hunt function was never defined. Replace the two non-ASCII characters with ASCII equivalents ('-' and '->'); the scripts are now pure ASCII, so PS 5.1 parses them regardless of code page and no BOM is needed. tests/test_ps1_ascii.py locks the invariant in on CI. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Fixes #183. Fixes #185.
Problem
BOM-less UTF-8
.ps1files are decoded by Windows PowerShell 5.1 with the system ANSI code page, not UTF-8. The em-dash (—, U+2014) and right-arrow (→, U+2192) in the scripts were read asâ€", the stray"closed a string literal early, and parsing cascaded into "missing )" / "unexpected }" errors:Every new PowerShell 5.1 window that dot-sources
hunt.ps1from$PROFILEthrew parser errors and never defined thehuntfunction. Reported independently in #183 and #185.Fix
Only two non-ASCII characters existed across all three scripts (
—×35,→×2). Replaced them with ASCII equivalents (-and->):scripts/hunt.ps1scripts/install.ps1scripts/install-community-skills.ps1The scripts are now pure ASCII, so PS 5.1 parses them regardless of code page — no BOM required (keeps the sources greppable and cross-platform-clean). All occurrences were in comments and output strings, so behavior is unchanged.
Test
tests/test_ps1_ascii.pyasserts everyscripts/*.ps1is ASCII-only, locking the invariant in on the existing ubuntu CI (PowerShell itself can't run there). Prevents re-introducing a non-ASCII char. Full tests suite 59/59.Note
Chose ASCII-replacement over shipping a UTF-8 BOM because only two characters were involved and both have clean ASCII forms; BOM would add bytes for no benefit and can trip non-PowerShell tooling. Related #189 fixes the same encoding class in the Python engine.
🤖 Generated with Claude Code