Fix PowerShell 5.1 parse failure in install scripts - #270
Merged
zanjonke merged 1 commit intoAug 5, 2026
Conversation
The PowerShell install scripts are UTF-8 without a BOM. Windows
PowerShell 5.1 therefore decodes them as ANSI (CP1252), where the
UTF-8 bytes for U+2713 (E2 9C 93) become U+00E2 U+0153 U+201C. That
trailing U+201C is a left double quotation mark, which 5.1 honours as
a string delimiter, so the enclosing string never terminates.
The parse then desyncs and reports errors far below the real cause.
In examples.ps1 the break is at line 76, but the first error surfaces
at line 102 as "Array index expression is missing or not valid",
which made the ${WHITE}[Enter]${NC} construct look responsible. That
construct is valid on 5.1; parsing it in isolation produces no errors.
Build the affected glyphs from their code points so the sources stay
pure ASCII, matching the existing $ESC = [char]27 idiom:
- examples.ps1: $CHECK, $CROSS
- install.ps1: $CHECK, $ROCKET
- walkthrough.ps1: $TRI plus box-drawing parts and $BOX_TOP/$BOX_BOTTOM
A BOM would fix file execution but break `irm ... | iex`, since 5.1
decodes a charset-less text/* body as ISO-8859-1 and the BOM arrives
as literal text.
Also add a windows-latest CI job that parses every install script with
both 5.1 and 7 via [Parser]::ParseFile, and rejects non-ASCII bytes and
BOMs so this cannot regress.
Fixes Codeplain-ai#264
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 #264