fix: build statusline emoji from codepoints to avoid mojibake

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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UW1aWQoAa6BPe1nNvkEYJU
This commit is contained in:
André Bezek
2026-07-19 12:27:07 +02:00
co-authored by Claude Opus 4.8
parent ec1d3c4d04
commit b94e653afa
+7 -1
View File
@@ -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)" }