Skip to content

fix(installer): pin -Encoding UTF8 on install-log writes - #591

Merged
LukasWodka merged 6 commits into
developfrom
fix/install-log-utf8-encoding
Aug 4, 2026
Merged

fix(installer): pin -Encoding UTF8 on install-log writes#591
LukasWodka merged 6 commits into
developfrom
fix/install-log-utf8-encoding

Conversation

@LukasWodka

@LukasWodkaLukasWodka commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Bugbot flagged this on the develop→staging promotion (client#589). Set-Content/Add-Content for the curated installer log default to PowerShell 5.1's ANSI encoding, which corrupts non-ASCII host paths/messages in the log operators send with -Diagnose. Every other writer in install-k8s.ps1 already pins -Encoding UTF8; this makes the two log writers (L161 Add-Content, L590 Set-Content) consistent. No behaviour change otherwise.


Note

Low Risk
Installer logging and diagnose packaging only; no cluster install or auth behavior changes.

Overview
Fixes mojibake in the Windows installer’s curated log and -Diagnose support bundle when paths or messages contain non-ASCII characters (#591).

Log() now appends with -Encoding UTF8. The install log header is created via WriteAllText with UTF-8 no BOM instead of Set-Content -Encoding UTF8, which would prepend a BOM on PowerShell 5.1. Edit-Redaction reads collected files with -Encoding UTF8 so BOM-less logs decode correctly on PS 5.1. scripts/manifest.sha256 is updated for install-k8s.ps1.

Reviewed by Cursor Bugbot for commit a4b58a7. Bugbot is set up for automated code reviews on this repo. Configure here.

Set-Content/Add-Content default to PS 5.1's ANSI encoding, corrupting non-ASCII
host paths/messages in the -Diagnose log; every other writer in this file already
pins -Encoding UTF8. (Bugbot on the staging promotion, backend#1497 sibling.)
@LukasWodkaLukasWodka self-assigned this Aug 4, 2026
Resolves the install-k8s.ps1 + manifest.sha256 conflict from #588 (graceful
error boundary). Re-applies the two -Encoding UTF8 edits to the log writers on
top of develop and regenerates the R8 manifest hash.
Re-resolves the recurring install-k8s.ps1 + manifest conflict; re-applies the two
-Encoding UTF8 log-writer edits on develop's tip and regenerates the R8 manifest.
saqlainsyed007
saqlainsyed007 previously approved these changes Aug 4, 2026

@saqlainsyed007saqlainsyed007 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving — clean, low-risk fix. I recomputed the SHA-256 of the new install-k8s.ps1 and it matches the updated manifest.sha256 line exactly, and the old hash isn't pinned anywhere else, so the bootstrap integrity check stays green. The ANSI→UTF-8 change correctly fixes the non-ASCII corruption and is consistent with the file's other -Encoding UTF8 writers.

One non-blocking note left inline.

Comment threadscripts/install-k8s.ps1 Outdated
…591)
Set-Content -Encoding UTF8 prepends a BOM on PowerShell 5.1, so the log started
with EF BB BF. Use the file's own no-BOM writer ([System.IO.File]::WriteAllText
with UTF8Encoding($false)); the Add-Content append path was already BOM-free.
Regenerates the R8 manifest hash.

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 235fca6. Configure here.

Comment threadscripts/install-k8s.ps1
…s (Bugbot, #591)
Start-InstallLog now writes the curated install log as UTF-8 without a BOM, but
Edit-Redaction -- which -Diagnose runs over every collected file before zipping,
including the copied install-*.log -- still read via `Get-Content -Raw` with no
encoding. On Windows PowerShell 5.1 a bare read decodes a BOM-less file as ANSI,
so it mangled every non-ASCII host path/message back into mojibake in the bundle
operators send: the exact corruption this PR set out to fix.
Pin `-Encoding UTF8` on that read. It reads the BOM-less log correctly and still
reads the Out-File -Encoding utf8 outputs (which carry a BOM on 5.1) fine -- the
BOM is detected and stripped. Regenerated scripts/manifest.sha256 for the new
install-k8s.ps1 hash.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@LukasWodka

Copy link
Copy Markdown
ContributorAuthor

Fixed the Bugbot finding in 235fca6's follow-up: Edit-Redaction (the redaction pass -Diagnose runs over every collected file, including the copied install-*.log) now reads with -Encoding UTF8. Without it, PS 5.1 decoded the now-BOM-less log as ANSI and re-wrote non-ASCII paths/messages as mojibake in the bundle — defeating the write-side fix. UTF-8 reads the BOM-less log correctly and still reads the BOM'd Out-File outputs fine. manifest.sha256 regenerated (PS parse clean, hash verified).

Note: this new commit dismissed the prior approval (stale-review dismissal) — @saqlainsyed007 a re-glance when you have a moment.

bugbot run

@LukasWodka
LukasWodka merged commit 1be36ad into developAug 4, 2026
36 of 37 checks passed
@LukasWodka
LukasWodka deleted the fix/install-log-utf8-encoding branch August 14, 2026 13:53
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@LukasWodka@saqlainsyed007@shujaatTracebloc