claude-code - 💡(How to fix) Fix [Bug] Country flag emojis render as separate regional-indicator letter tiles in TUI (macOS, Ghostty) [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#52651Fetched 2026-04-24 06:01:28
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
labeled ×3

Country flag emojis (regional indicator pairs, e.g. 🇯🇵 🇺🇸 🇮🇩) render as their two underlying letter tiles ("JP", "US", "ID") inside the Claude Code TUI, even though the same codepoints render correctly as flags elsewhere in the same terminal.

This appears to be a string-width / grapheme-clustering issue in Ink's handling of regional indicator sequences — the two codepoints are being treated as separate graphemes instead of a single width-2 flag cluster, so the terminal renders them individually and skips the OpenType flag ligature.

Distinct from #46805, which is a crash (API 500 on surrogate pairs in history). This is a pure rendering bug — no crash, just wrong pixels.

Root Cause

Regional indicator sequences are a first-class emoji category (Unicode 6.0). For anyone using flag emojis semantically — e.g. geographic tagging in a note/project ontology — the TUI becomes unreadable for their tags while every other surface (Obsidian, browser, system-wide) works fine.

RAW_BUFFERClick to expand / collapse

Summary

Country flag emojis (regional indicator pairs, e.g. 🇯🇵 🇺🇸 🇮🇩) render as their two underlying letter tiles ("JP", "US", "ID") inside the Claude Code TUI, even though the same codepoints render correctly as flags elsewhere in the same terminal.

This appears to be a string-width / grapheme-clustering issue in Ink's handling of regional indicator sequences — the two codepoints are being treated as separate graphemes instead of a single width-2 flag cluster, so the terminal renders them individually and skips the OpenType flag ligature.

Distinct from #46805, which is a crash (API 500 on surrogate pairs in history). This is a pure rendering bug — no crash, just wrong pixels.

Environment

  • Claude Code: 2.1.119
  • OS: macOS 26.3.1 (Apple Silicon)
  • Terminal: Ghostty 1.3.1
  • Shell: zsh

Repro

  1. In a Claude Code session, send or have Claude echo a message containing 🇯🇵 🇺🇸 🇮🇩 🇬🇧
  2. Observe: they appear as letter-pair tiles ("JP", "US", "ID", "GB")
  3. Quit Claude Code, at the zsh prompt run echo 🇯🇵 🇺🇸 🇮🇩 🇬🇧 — flags render correctly

Expected

Flags render as flags in the TUI, matching the host terminal's rendering of the same codepoints.

Why this matters

Regional indicator sequences are a first-class emoji category (Unicode 6.0). For anyone using flag emojis semantically — e.g. geographic tagging in a note/project ontology — the TUI becomes unreadable for their tags while every other surface (Obsidian, browser, system-wide) works fine.

Likely cause

string-width / grapheme-splitting logic isn't collapsing RI+RI into a single cluster consistently. Ink then emits the two codepoints with positioning that breaks the terminal's ligature opportunity. References: past related issues #30471, #23878.

extent analysis

TL;DR

Update the string-width library or modify the grapheme-clustering logic in Ink to correctly handle regional indicator sequences as a single width-2 flag cluster.

Guidance

  • Investigate the string-width library version used in Claude Code 2.1.119 and check for any known issues or updates related to grapheme clustering.
  • Review the Ink rendering logic to ensure it correctly collapses regional indicator pairs into a single cluster, considering past related issues #30471 and #23878.
  • Test the rendering of regional indicator sequences in different environments and terminals to identify any inconsistencies.
  • Consider temporarily using a workaround, such as replacing regional indicator sequences with their corresponding flag emojis, until a permanent fix is implemented.

Example

No code snippet is provided as the issue is related to the underlying library and rendering logic.

Notes

The issue is specific to the Claude Code TUI and does not affect other surfaces, such as Obsidian or browsers. The problem is likely related to the string-width library or Ink's grapheme-clustering logic.

Recommendation

Apply a workaround, such as replacing regional indicator sequences with their corresponding flag emojis, until a permanent fix is implemented, as updating the string-width library or modifying the Ink rendering logic may require significant changes.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING