From 57edc629c176bab7d2d80fad4e72d44a4a518596 Mon Sep 17 00:00:00 2001 From: Kelly Michels Date: Wed, 30 Sep 2026 11:25:59 -0500 Subject: [PATCH] =?UTF-8?q?fix(deploy):=20decode=20the=20box's=20output=20?= =?UTF-8?q?as=20UTF-8=20so=20progress=20bars=20render=20as=20bars,=20not?= =?UTF-8?q?=20"=CE=93=C3=B6=C3=BC"=20(#94)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(deploy): decode the box's output as UTF-8, so progress bars are bars and not "Γöü" Mirror of the same change in the private scripts repo: [Console]::OutputEncoding is switched to UTF-8 (no BOM) around the deploy loop and restored in a finally. PowerShell 5.1 decodes ssh's stdout with the OEM code page, where the UTF-8 bytes of a progress bar read as three characters each. Co-Authored-By: Claude Fable 5.1 * chore(checksums): zdeploy.ps1 changed, so its entry in CHECKSUMS.txt follows Co-Authored-By: Claude Fable 5.1 --------- Co-authored-by: Claude Fable 5.1 --- CHECKSUMS.txt | 2 +- zdeploy.ps1 | 43 ++++++++++++++++++++++++++++--------------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/CHECKSUMS.txt b/CHECKSUMS.txt index b57447f..0690ba8 100644 --- a/CHECKSUMS.txt +++ b/CHECKSUMS.txt @@ -8,7 +8,7 @@ b407ef5b298cd6fe94af492e9254b4447e34333d22f8c29d3e9d4d2881651cf3 zbackup_ec2.cm 64bc3148b09e422ffe4890339fade2354a31f2c7ba004f2728c29a0a39c32f08 zchecksums.cmd 3e1c573e446238cae494d22d25376f278333dc25fdbc0a5abbdaa9349722b438 zchecksums.ps1 049f8e79fc8c3d8d96ae8ccb1155d191e2dbf2753f4d4d73ceca00aa1ab0481b zdeploy.cmd -a55be5b5e857463fa3e321ff2a73337f8281b56f6dfd0a7e36ed1f7ba242afbc zdeploy.ps1 +e87c9fcd494fd2b8399b14c18a1dfa72805e5c52a38f132591b4d523b8806631 zdeploy.ps1 30918a9260cb6220d6e2140edcf319fc0fa1e75b7fe36d0efe68b0d10cdde241 zec2.cmd 695ec87ea6518933ee64524d369f1d0d5128bf6e54db31f555a888bdddcb9326 zec2.ps1 ce3209ed8eaab242286e76aeb11b1249239e2804e3de456a1609cc7caa780b43 zec2_rotatekeys.cmd diff --git a/zdeploy.ps1 b/zdeploy.ps1 index 857f455..c619e81 100644 --- a/zdeploy.ps1 +++ b/zdeploy.ps1 @@ -1304,22 +1304,35 @@ function Invoke-ZTokensPublish { # ── Dispatch ───────────────────────────────────────────────────────────────── -foreach ($key in $Projects) { - # 'ztokens' matches the tool it runs (ztokens.cmd / ztokens.ps1). The old - # singular 'ztoken' still works so existing habits and any script that - # already calls it keep running. - if ($key -in @('ztokens', 'ztoken')) { Invoke-ZTokensPublish; continue } - $proj = Get-ZProject -Key $key - Invoke-DeployGitPull -Proj $proj # no-op unless deploy.gitPull is set - switch ([string]$proj.kind) { - "python" { Invoke-PythonDeploy -Key $key -Proj $proj -ChangeNote $Note } - "vite" { Invoke-ViteDeploy -Key $key -Proj $proj -ChangeNote $Note } - "nextjs" { Invoke-NextDeploy -Key $key -Proj $proj -ChangeNote $Note } - "edge" { Invoke-EdgeDeploy -Key $key -Proj $proj } - "docker" { Invoke-DockerDeploy -Key $key -Proj $proj } - "static" { Invoke-StaticDeploy -Key $key -Proj $proj } - default { throw "No deploy handler for kind '$($proj.kind)' (project '$key'). Add an Invoke-Deploy function in zdeploy.ps1." } +# pip, uv and docker draw progress bars with box-drawing characters: "━" is +# the bytes E2 94 81. PowerShell 5.1 decodes a native command's stdout - ssh's, +# here - with [Console]::OutputEncoding, which on Windows is the OEM code page +# (437 on this machine), where those three bytes read "Γöü". Forty per bar. +# Decode the box's output as the UTF-8 it is for the duration of the deploy, +# and put the console back in the finally so a deploy that throws does not +# leave the session changed. +$prevConsoleEncoding = [Console]::OutputEncoding +[Console]::OutputEncoding = New-Object System.Text.UTF8Encoding($false) +try { + foreach ($key in $Projects) { + # 'ztokens' matches the tool it runs (ztokens.cmd / ztokens.ps1). The old + # singular 'ztoken' still works so existing habits and any script that + # already calls it keep running. + if ($key -in @('ztokens', 'ztoken')) { Invoke-ZTokensPublish; continue } + $proj = Get-ZProject -Key $key + Invoke-DeployGitPull -Proj $proj # no-op unless deploy.gitPull is set + switch ([string]$proj.kind) { + "python" { Invoke-PythonDeploy -Key $key -Proj $proj -ChangeNote $Note } + "vite" { Invoke-ViteDeploy -Key $key -Proj $proj -ChangeNote $Note } + "nextjs" { Invoke-NextDeploy -Key $key -Proj $proj -ChangeNote $Note } + "edge" { Invoke-EdgeDeploy -Key $key -Proj $proj } + "docker" { Invoke-DockerDeploy -Key $key -Proj $proj } + "static" { Invoke-StaticDeploy -Key $key -Proj $proj } + default { throw "No deploy handler for kind '$($proj.kind)' (project '$key'). Add an Invoke-Deploy function in zdeploy.ps1." } + } } +} finally { + [Console]::OutputEncoding = $prevConsoleEncoding } # The timestamp goes through Stop-ZTracking as the FinalNote so it lands after # the tracking footer and before the trailing blank lines - the last thing on