Inspect combined Unicode letters and grapheme boundaries

How combining marks, emoji sequences and flags form single visible characters, why naive reversal breaks them, and how to check text before transforming it.

A letter that looks like one character on screen can be stored as several Unicode code points. An accented letter may be a base letter plus a combining mark. A family emoji may be several people joined by invisible connectors. A flag is two regional indicator symbols. Tools that reverse, mirror, restyle or truncate text work on stored characters, so the boundary between what you see and what is stored decides whether the output stays readable. This review explains how combined letters work, what grapheme boundaries are, and how to judge whether a transformation will keep your text intact.

Short verdict: when grapheme-aware handling matters

Inspecting grapheme boundaries is worth doing whenever a transformation reorders, splits, counts or substitutes characters, especially with accented names, non-Latin scripts, emoji or flags. The main benefit is predictable output: a grapheme-aware tool moves each visible character as a unit, so accents stay on the right letter and emoji sequences stay whole. The decisive tradeoff is that grapheme segmentation depends on the Unicode version and the library a tool uses, so two tools can still disagree on edge cases. If the text must be searched, edited, read by assistive technology or pasted into forms, plain unmodified text is usually the better choice, with any styled or reversed version treated as decoration alongside it.

Code points, grapheme clusters and glyphs

Three different units are often all called a "character," which is where most confusion starts. A code point is a single numbered entry in Unicode. A grapheme cluster is what a reader perceives as one character, and it may contain several code points. A glyph is the shape a font draws, and a font may draw one grapheme with several glyphs or merge several into one ligature. Unicode Standard Annex #29 defines extended grapheme clusters, and most grapheme-aware libraries follow it.

Visible text | Stored code points | Grapheme clusters
é (precomposed) | U+00E9 | 1
é (decomposed) | U+0065 U+0301 | 1
Canadian flag | U+1F1E8 U+1F1E6 | 1
Family emoji (man, woman, girl) | U+1F468 U+200D U+1F469 U+200D U+1F467 | 1

Both forms of é look identical but are stored differently. U+0301 is COMBINING ACUTE ACCENT, which attaches to whatever precedes it. U+200D is ZERO WIDTH JOINER, which asks the font to merge neighboring emoji into one image if the font supports that sequence. Regional indicator symbols pair up to name a region, and the platform decides whether to show a flag or the two letters.

What a transformation actually changes

"Reverse" and "mirror" describe different operations. Character reversal rewrites the stored order of characters. Word reversal reorders words but keeps each word's letters. Mirror text usually substitutes look-alike characters that resemble flipped letters, which changes stored characters rather than flipping anything. CSS transforms and bidirectional display change only how text is drawn; the stored characters stay the same, so copying gives back the original. "Font" generators rarely change fonts; they typically replace letters with different Unicode characters such as mathematical alphanumeric symbols. Grapheme boundaries matter most for the operations that rewrite stored order or substitute characters.

How naive reversal breaks combined letters

A reversal that works on code points instead of grapheme clusters moves combining marks away from their base letters. Take "café" written in decomposed form. Reversed by code point, the accent ends up first, attached to nothing, and the e that should carry it now sits bare.

Input code points:     c  a  f  e  U+0301
Code point reversal:   U+0301  e  f  a  c
Grapheme reversal:     e+U+0301  f  a  c

In the code point result, a leading combining mark is often drawn over a dotted circle or a space, or on the wrong neighbor, depending on the renderer. The same input in precomposed form reverses correctly even with a naive tool, because the accented letter is one code point. That makes the bug easy to miss: it appears only when the input happens to be decomposed, which can depend on the keyboard, operating system or source the text came from.

Emoji sequences fail in similar ways. Reversing the family emoji by code point keeps the joiners but reverses the order of the people, which may display as a different sequence or as separate emoji if the font has no image for the new order. Flags can silently become other flags: the Canadian flag is the regional indicators C and A, and reversing them gives A and C, the code for Ascension Island, which many platforms display as a valid flag. No error appears, yet the meaning has changed.

Inspecting text yourself

Listing each code point with its official name shows whether a letter is precomposed or built from parts. In Python, the standard unicodedata module does this:

import unicodedata

for ch in "cafe\u0301":
    print(f"U+{ord(ch):04X} {unicodedata.name(ch)}")

# U+0063 LATIN SMALL LETTER C
# U+0061 LATIN SMALL LETTER A
# U+0066 LATIN SMALL LETTER F
# U+0065 LATIN SMALL LETTER E
# U+0301 COMBINING ACUTE ACCENT

To work in grapheme clusters rather than code points, JavaScript environments that support Intl.Segmenter can split text the way a reader sees it. The example below reverses safely by grapheme:

const seg = new Intl.Segmenter("en", { granularity: "grapheme" });
const text = "cafe\u0301";

// Breaks the accent: reverses code points
const naive = [...text].reverse().join("");

// Keeps the accent on the e: reverses grapheme clusters
const safe = [...seg.segment(text)]
  .map((s) => s.segment)
  .reverse()
  .join("");

Length checks reveal the same layers. In JavaScript, the length property counts UTF-16 code units, so a single flag reports a length of 4. In Python, len counts code points, so decomposed é reports 2. Neither matches what a reader would count, which affects character limits, truncation and cursor movement.

Normalization: useful, but not a full fix

Unicode normalization converts text between composed (NFC) and decomposed (NFD) forms. Normalizing to NFC before a naive transformation helps with common accented Latin letters, because many have precomposed equivalents. It does not solve the general problem: some letter and mark combinations have no precomposed form, stacked marks stay separate, and normalization does nothing for emoji or flag sequences. Normalization also matters for comparison, since the two forms of the same word are different strings unless a system normalizes them first. Whether a particular search box, database or platform does so is not something to assume; check its documentation or test it.

Readability after copying, sharing and searching

Copying preserves stored characters, not appearance. A CSS mirror or bidirectional display effect disappears on copy, while a character reversal or substitution travels with the text. Broken clusters travel too: a stray combining mark pasted into another app may render differently there, because rendering depends on the destination's fonts and text engine. One correct rendering does not show that every destination will behave the same way.

Reversed or substituted text is generally harder to search, since search engines and site search match stored characters and a reversed word is a different string. Editing is also harder, because cursor movement and deletion follow each app's own grapheme rules, which may differ between tools built on different Unicode versions. For assistive technology, reversed text is read in its stored order, and substituted look-alike characters or orphaned marks may be announced by name, skipped or read unpredictably. Behavior varies between screen readers and platforms, and no tested results were available for this review, so test with the specific assistive technology your audience uses before relying on any transformed text.

When to keep plain text

  • Names, addresses and identifiers that people need to search for, copy into forms or match against records.
  • Content that must be accessible, unless an unmodified plain-text equivalent is provided next to it.
  • Text with flags, multi-person or skin-tone emoji, or heavily accented scripts, when the tool's handling of grapheme clusters is undocumented.
  • Anything subject to character limits, where code unit, code point and grapheme counts may disagree.

Checklist for evaluating a transformation tool

  • Test a decomposed accented word, not only precomposed text, and confirm accents stay on the correct letters.
  • Test a flag and a joined emoji sequence, and check that a reversed flag has not become a different flag.
  • Inspect the output's code points to confirm what was stored, separate from how it looks.
  • Paste the result into each real destination and check display, search and editing there.
  • Check whether the tool documents grapheme segmentation or the Unicode version it follows; if it does not, treat edge-case behavior as unknown.

Gaps in this review

No specific tool, platform or screen reader was tested for this review, so it makes no claims about how any named product handles grapheme clusters, normalization or copy and paste. Grapheme rules also change across Unicode versions, including refinements for some scripts where a perceived letter spans several clusters, so results can differ between otherwise similar tools. The examples above illustrate the mechanisms; your own destination and audience are what determine whether a given transformation is usable.