fix: decode native output as UTF-8 on Windows, so progress bars stop mojibaking

winget draws its progress bar with UTF-8 block characters, but PowerShell
decodes native output using the console codepage (437), turning each block into
three Latin characters and burying the real messages. Sets
[Console]::OutputEncoding to UTF-8 in install-windows.ps1, and chcp 65001 in
ncp.cmd for the check marks and em-dashes ncp.py prints.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
jon
2026-07-22 14:32:43 -05:00
co-authored by Claude Opus 4.8
parent 4961d765c8
commit 18df04c5d8
2 changed files with 15 additions and 0 deletions
+7
View File
@@ -7,6 +7,13 @@ REM the machine PATH. ncp.ps1 stays for pwsh-on-Linux, where there is no PATH sh
REM
REM ASCII only, same rule as the .ps1 files - a test in tests/test_smoke.py enforces it.
setlocal
REM ncp.py pins its stdout to UTF-8 (it prints check marks and em-dashes, and a
REM redirected stdout would otherwise raise UnicodeEncodeError). A console still
REM on codepage 437 renders those bytes as mojibake, so switch it to UTF-8 here.
REM ponytail: chcp changes the calling console's codepage and does not restore
REM it on exit. Harmless in practice; if that ever matters, set the console CP
REM from inside ncp.py with ctypes SetConsoleOutputCP instead.
chcp 65001 >nul 2>&1
set "ROOT=%~dp0.."
REM System Python fallback so backup/restore work before the venv exists; those
REM delegate to the stdlib-only bin/sync.py. Mirrors the same fallback in ncp.ps1.