Fix install script premature string termination for older versions of PowerShell/Windows#4
Conversation
📝 WalkthroughWalkthroughThree console output strings in ChangesConsole Message Dash Character Fix
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
scripts/install.ps1 (1)
1-166: 💤 Low valueNote: Static analysis reports missing BOM encoding, but current fix addresses root issue.
PSScriptAnalyzer warns about missing UTF-8 BOM for files with non-ASCII characters, which can cause Windows PowerShell to misinterpret the script as legacy "ANSI" codepage. However, the current fix strategically removes all non-ASCII characters (replacing em dashes with hyphens), which resolves the encoding conflict entirely and makes the BOM warning moot. The script now contains only ASCII characters and will parse consistently across PowerShell versions without requiring BOM.
For future maintenance: if non-ASCII characters are reintroduced, save the file as UTF-8 with BOM if Windows PowerShell 5.1 compatibility is needed. For now, the current approach is effective and doesn't require immediate action.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/install.ps1` around lines 1 - 166, The review comment notes that PSScriptAnalyzer may report missing UTF-8 BOM encoding, but confirms this has already been resolved by removing all non-ASCII characters from the script (replacing em dashes with hyphens in the section headers throughout the file). No immediate action is required. However, for future reference: if non-ASCII characters need to be reintroduced anywhere in the install.ps1 script, ensure the file is saved as UTF-8 with BOM encoding to maintain compatibility with Windows PowerShell 5.1 and avoid codepage misinterpretation issues.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@scripts/install.ps1`:
- Around line 1-166: The review comment notes that PSScriptAnalyzer may report
missing UTF-8 BOM encoding, but confirms this has already been resolved by
removing all non-ASCII characters from the script (replacing em dashes with
hyphens in the section headers throughout the file). No immediate action is
required. However, for future reference: if non-ASCII characters need to be
reintroduced anywhere in the install.ps1 script, ensure the file is saved as
UTF-8 with BOM encoding to maintain compatibility with Windows PowerShell 5.1
and avoid codepage misinterpretation issues.
PowerShell 5.1 (Windows 10 22H2) reads UTF-8 files as Windows-1252 by default, and the UTF-8 byte sequence for — (em dash) contains 0x94, which Windows-1252 maps to " (right double quotation mark) which is a valid string terminator in PowerShell.
This caused the string literals on lines 59, 152, and 165 to be prematurely closed, making the enclosing if/else blocks appear unclosed. Replacing all three em dashes with - resolved such errors during install.
Summary by CodeRabbit