Skip to content

Commit e5a272a

Browse files
fix(install): strip non-ASCII bytes from install.ps1 (#1523)
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: danielmeppiel <danielmeppiel@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 61917d6 commit e5a272a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

install.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ try {
729729
# there is still a small gap where neither path exists; doing it this
730730
# way minimizes that gap and lets us roll back if the second rename
731731
# fails. Concurrent apm invocations during that window will fail and
732-
# need a retry acceptable for an install/self-update operation.
732+
# need a retry -- acceptable for an install/self-update operation.
733733
$backupDir = $null
734734
if (Test-Path $releaseDir) {
735735
$backupDir = "$releaseDir.old-" + [System.Guid]::NewGuid().ToString("N")
@@ -802,7 +802,8 @@ try {
802802
# Write the shim as ASCII. cmd.exe interprets .cmd files via the system
803803
# OEM/ANSI code page and does NOT reliably auto-detect UTF-16LE (even
804804
# with a BOM) when batch files are invoked via PATH or double-click; a
805-
# UTF-16 shim surfaces as garbled output like ">��@" and exit code 1.
805+
# UTF-16 shim surfaces as garbled bytes (the cmd.exe prompt followed
806+
# by replacement-character noise) and exit code 1.
806807
# ASCII is safe for our payload because the %LOCALAPPDATA% literal
807808
# token (issue #1509) keeps the embedded shim target ASCII-only even
808809
# when the user's profile directory contains non-ASCII characters.

0 commit comments

Comments
 (0)