From b94e653afaccc1787e50eb806b2bc65151770f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bezek?= <200930841+Andre-Bzk@users.noreply.github.com> Date: Sun, 19 Jul 2026 12:27:07 +0200 Subject: [PATCH] fix: build statusline emoji from codepoints to avoid mojibake MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Windows PowerShell 5.1 reads a BOM-less .ps1 as the ANSI codepage, so literal UTF-8 emoji bytes rendered as mojibake (⏳ -> â³, 📅 -> 📅). Build the hourglass and calendar glyphs from codepoints instead, matching how the bar/§ characters are already produced. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01UW1aWQoAa6BPe1nNvkEYJU --- assets/cship-statusline.ps1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/assets/cship-statusline.ps1 b/assets/cship-statusline.ps1 index 727253f..19f56e0 100644 --- a/assets/cship-statusline.ps1 +++ b/assets/cship-statusline.ps1 @@ -36,7 +36,13 @@ $render = [System.Text.RegularExpressions.MatchEvaluator]{ elseif ($pct -ge 40) { $color = '33' } else { $color = '38;2;125;207;255' } - if ($type -eq '5') { $label = '⏳ 5h' } else { $label = '📅 7d' } + # Emoji are built from codepoints (not string literals) so the label renders + # correctly regardless of how this .ps1 is read from disk. Windows PowerShell + # 5.1 decodes a BOM-less script as the ANSI codepage, which would turn literal + # UTF-8 emoji bytes into mojibake (e.g. ⏳ -> â³, 📅 -> 📅). + $hourglass = [char]0x23F3 # ⏳ (BMP) + $calendar = [char]::ConvertFromUtf32(0x1F4C5) # 📅 (astral, needs surrogate pair) + if ($type -eq '5') { $label = "$hourglass 5h" } else { $label = "$calendar 7d" } $pctTxt = '{0:0}%' -f $pct $resetTxt = if ([string]::IsNullOrWhiteSpace($reset)) { '' } else { " ($reset)" }