fix(windows): add UTF-8 BOM to PowerShell scripts#20
Conversation
Fixes #19 PowerShell 5.1 on Windows defaults to the system ANSI codepage when parsing .ps1 files and misreads the UTF-8 multibyte sequences used in the banner (━, ·, ║, etc.). Without a BOM the parser corrupts these bytes, producing cascading parse errors: Unexpected token '}' in expression or statement. The string is missing the terminator. Missing closing '}' in statement block or type definition. Adding a UTF-8 BOM (EF BB BF) tells PowerShell to decode the file as UTF-8, resolving the parse errors. The reporter confirmed this on Windows 11. Applied to both setup.ps1 and uninstall.ps1. The file body is unchanged — only the 3-byte BOM was prepended.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughA leading UTF-8 BOM character is prepended to the first line of both ChangesPowerShell Script BOM Encoding Fix
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoFix Windows PowerShell parsing by adding UTF-8 BOM to .ps1 scripts Description
Diagram
High-Level Assessment
Files changed (2)
|
Fixes #19
PowerShell 5.1 on Windows defaults to the system ANSI codepage when parsing .ps1 files and misreads the UTF-8 multibyte sequences used in the banner (━, ·, ║, etc.). Without a BOM the parser corrupts these bytes, producing cascading parse errors:
Unexpected token '}' in expression or statement.
The string is missing the terminator.
Missing closing '}' in statement block or type definition.
Adding a UTF-8 BOM (EF BB BF) tells PowerShell to decode the file as UTF-8, resolving the parse errors. The reporter confirmed this on Windows 11.
Applied to both setup.ps1 and uninstall.ps1. The file body is unchanged — only the 3-byte BOM was prepended.
Description
Describe your changes and the reasoning behind them.
Related Issue / PR
Fixes # (issue) or relates to # (PR)
Type of Change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
bash tests/test_e2e.shChecklist
shfmton shell scripts)Summary by CodeRabbit