mirror of
https://github.com/Andre-Bzk/claude-statusline-kit.git
synced 2026-11-15 09:33:04 +01:00
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:
co-authored by
Claude Opus 4.8
parent
ec1d3c4d04
commit
b94e653afa
@@ -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)" }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user