diff --git a/install-windows.ps1 b/install-windows.ps1 index f26e0b8..f800bac 100644 --- a/install-windows.ps1 +++ b/install-windows.ps1 @@ -18,6 +18,14 @@ Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" $RepoRoot = $PSScriptRoot +# winget draws its progress bar with U+2588/U+2592 block characters in UTF-8, +# but PowerShell decodes a native command's output using the CONSOLE codepage +# (437 on a US box). The three UTF-8 bytes of a block then render as "Gamma u e" +# - the log fills with 'GubebGubeb...' mojibake and the real messages get lost +# in it. Decoding as UTF-8 is the fix; it is per-process and does not touch the +# user's console settings. +[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 + # -- Helpers ------------------------------------------------------------------- function Write-Step { param([string]$Msg) Write-Host "`n==> $Msg" -ForegroundColor Cyan } function Write-OK { param([string]$Msg) Write-Host " ok: $Msg" -ForegroundColor Green } diff --git a/management/ncp.cmd b/management/ncp.cmd index 7bf2388..ab86734 100644 --- a/management/ncp.cmd +++ b/management/ncp.cmd @@ -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.