Skip to content

Fix PowerShell 5.1 parse failure in install scripts - #270

Merged
zanjonke merged 1 commit into
Codeplain-ai:mainfrom
sunasrd-byte:fix/powershell-51-ansi-parse
Aug 5, 2026
Merged

Fix PowerShell 5.1 parse failure in install scripts#270
zanjonke merged 1 commit into
Codeplain-ai:mainfrom
sunasrd-byte:fix/powershell-51-ansi-parse

Conversation

@sunasrd-byte

Copy link
Copy Markdown
Contributor

Fixes #264

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
@zanjonke
zanjonke self-requested a review August 3, 2026 10:14
@zanjonke zanjonke added the bug Something isn't working label Aug 3, 2026

@zanjonke zanjonke left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@zanjonke
zanjonke merged commit b515774 into Codeplain-ai:main Aug 5, 2026
7 checks passed
@sunasrd-byte
sunasrd-byte deleted the fix/powershell-51-ansi-parse branch August 5, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Install script fails on Windows when downloading plainlang-examples

2 participants