fix(deploy): decode the box's output as UTF-8 so progress bars render as bars, not "Γöü" (#94)

* 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 <noreply@anthropic.com>

* chore(checksums): zdeploy.ps1 changed, so its entry in CHECKSUMS.txt follows

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Kelly Michels 2026-09-30 11:25:59 -05:00 committed by GitHub
parent 73dd27c4f1
commit 57edc629c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 29 additions and 16 deletions

View File

@ -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

View File

@ -1304,7 +1304,17 @@ function Invoke-ZTokensPublish {
# ── Dispatch ─────────────────────────────────────────────────────────────────
foreach ($key in $Projects) {
# 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.
@ -1320,6 +1330,9 @@ foreach ($key in $Projects) {
"static" { Invoke-StaticDeploy -Key $key -Proj $proj }
default { throw "No deploy handler for kind '$($proj.kind)' (project '$key'). Add an Invoke-<Kind>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