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)" }