fix(install): strip non-ASCII bytes from install.ps1 (unblocks self-update on cp1252 consoles)#1523
Merged
danielmeppiel merged 1 commit intoMay 28, 2026
Conversation
Follow-up to this PR's first commit. The Windows CI 'apm self-update'
test (Test 5) downloads install.ps1 via Python urllib in the v0.13.0
installed CLI and prints it through a cp1252 console; the script
must therefore be pure ASCII or the print raises
'charmap codec can't encode characters in position 33941-33942'.
Two violations of the repo's ASCII-only rule
(.github/instructions/encoding.instructions.md):
1. Em-dash (U+2014) in a pre-existing comment at byte 29170
('need a retry -- acceptable for an install/self-update').
Replaced with the ASCII '--' digraph.
2. Replacement characters (U+FFFD U+FFFD) at byte 33139 inside the
comment this PR just added describing what a UTF-16 cmd.exe parse
failure looks like. I had literally pasted the garbled-output
illustration verbatim. Reworded to describe the failure mode in
plain ASCII prose.
install.ps1 now contains zero bytes above 0x7E. The previously-failing
self-update path can write the script to a cp1252 console without
raising UnicodeEncodeError.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Removes two non-ASCII byte sequences from install.ps1 (an em-dash and replacement characters in comments) so that the v0.13.0 self-updater, which prints the downloaded script via a cp1252 Windows console, no longer raises UnicodeEncodeError. Brings the file into compliance with the repo's printable-ASCII encoding contract.
Changes:
- Replace em-dash with
--in the rollback-window comment at line 732. - Replace
">��@"replacement chars with plain ASCII prose describing the UTF-16 cmd.exe failure mode at lines 805-806.
Show a summary per file
| File | Description |
|---|---|
| install.ps1 | Strips two non-ASCII byte sequences from comments to satisfy the printable-ASCII encoding rule. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
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.
TL;DR
Follow-up to #1522. The Windows CI
apm self-updatetest (run 26543072369) fails with:install.ps1contained two non-ASCII byte sequences -- an em-dash (pre-existing) and replacement chars I introduced in a comment. The v0.13.0 self-updater downloads install.ps1 via Python urllib and prints it through a cp1252 console; non-ASCII bytes raiseUnicodeEncodeError.Problem (WHY)
Per the repo's encoding contract (
.github/instructions/encoding.instructions.md):Two violations in install.ps1:
# need a retry — acceptable for an install/self-update operation.Why this only surfaced now: #1522 fixed the
apm.cmdshim, which previously crashed before reaching the self-update path. With the shim working, Test 5 can now exercise self-update end-to-end -- and immediately hits the cp1252 wall on the downloaded install.ps1.Approach (WHAT)
Replace both non-ASCII sequences with their ASCII equivalents:
—(em-dash) ->--(ASCII digraph)">��@"(replacement chars) -> plain ASCII prose describing the failure modeinstall.ps1now contains zero bytes above 0x7E (verified by hand-scan).Validation evidence
python3 -c "data = open('install.ps1','rb').read(); ..."reports no bytes > 127.tests/unit/install/test_windows_shim_template.pystill pass.apm self-updatetest will run on this PR -- the only ground-truth verification.Trade-offs
None. ASCII-equivalent prose is strictly required by the repo's encoding rule; this PR brings install.ps1 into compliance.
Refs #1522.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com