Skip to content

fix(windows): ASCII-only PowerShell scripts — PS 5.1 parse crash (#183, #185) - #192

Merged
elementalsouls merged 1 commit into
mainfrom
fix/ps1-ascii-powershell51
Nov 20, 2026
Merged

elementalsouls merged 1 commit into
mainfrom
fix/ps1-ascii-powershell51

Conversation

@elementalsouls

Copy link
Copy Markdown
Owner

Fixes #183. Fixes #185.

Problem

BOM-less UTF-8 .ps1 files 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:

Token ')' unexpected ...
+ ... ir 'findings\README.md') ("# Findings â€" $Target" + $findingsReadme)

Every new PowerShell 5.1 window that dot-sources hunt.ps1 from $PROFILE threw parser errors and never defined the hunt function. 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.ps1
  • scripts/install.ps1
  • scripts/install-community-skills.ps1

The 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.py asserts every scripts/*.ps1 is 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

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>
@elementalsouls
elementalsouls merged commit 9ff0859 into main Nov 20, 2026
6 checks passed
@elementalsouls
elementalsouls deleted the fix/ps1-ascii-powershell51 branch November 20, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant