Reversing a short label can change more than the positions of its letters. A flag emoji may contain two Unicode code points, and reversing those parts can produce a different flag. Check the unit being reversed before copying a result into a caption or design.
This guide reproduces that change in the Reverse Text tool, then shows a separate JavaScript approach that keeps grapheme groups intact. Keep an untouched copy of the original throughout the check.
Test a flag between two ordinary letters
- Open Reverse Text and enter this exact sample in Your text, without spaces or a final newline:
A🇮🇳B
- Under What should be reversed, select Whole text, character by character.
- Read Reversed text, which updates automatically. The current result is:
B🇳🇮A
A moved to the end and B moved to the beginning. The flag sequence also changed: the India pair became the Nicaragua pair. The input counter reports four characters because it counts code points, including the two inside the flag.
Your device may display flag artwork, regional indicator letters or another fallback. Use the code-point order as the check rather than relying on the picture alone. The official Unicode emoji chart lists these sequences:
| Sequence | Code points in order | Chart name |
|---|---|---|
🇮🇳 |
U+1F1EE U+1F1F3 |
India flag |
🇳🇮 |
U+1F1F3 U+1F1EE |
Nicaragua flag |
Understand what the tool keeps together
The current whole-text implementation creates an array from the string, reverses that array and joins it again. JavaScript string iteration yields Unicode code points. It keeps a surrogate pair together, but it can split a grapheme cluster into its component code points, as the MDN string iterator reference explains.
A grapheme cluster is a group commonly perceived as one character. Some emoji and accented letters contain several code points. Keeping each code point intact therefore does not guarantee that the displayed group keeps its internal order.
Try A😊B as a control. It becomes B😊A; that smile uses one code point. This successful case does not establish that every emoji will survive the same operation. The tool message about handling emoji and accents as whole characters is broader than its actual behavior with the flag sample.
A decomposed accent can also move away from its letter. With an e followed by combining acute accent U+0301, code-point reversal exchanges the accent and the e. Check the underlying sequence whenever the result looks plausible but different.
Reverse grapheme groups when that is the intended task
For a deliberate character-order exercise that should retain the flag, group the text before reversing it. In an existing JavaScript environment that provides Intl.Segmenter, this original example uses grapheme segmentation:
const original = "A🇮🇳B";
const segmenter = new Intl.Segmenter("en", {
granularity: "grapheme"
});
const groups = Array.from(
segmenter.segment(original),
part => part.segment
);
const reversed = groups.reverse().join("");
console.log(reversed);
// B🇮🇳A
The flag stays between the letters with its original code-point order. The MDN Segmenter constructor reference documents the grapheme option. Confirm this API is available in the environment running your code before applying the example to a larger batch.
This is a separate local script, not a setting offered by the on-site tool. Review its returned text before saving it. Preserving groups also does not make backwards prose useful; choose a reversal only when the task actually calls for it.
Choose line order for a list of complete entries
If your real task is to put the last list entry first, select Line order instead of reversing the characters inside it. That mode leaves the flag sequence within each line unchanged. Our line-order reversal guide covers blank lines, repeated entries and final newlines for that separate task.
Do not use character reversal as a shortcut for sorting or moving complete records. Decide whether the unit you need to move is a line, a word or a grapheme group before processing the text.
Verify the exact copy in its destination
Check the first and last letters, the flag identity and any combined accents before copying. Inspect the saved text in the application where it will appear, since its font may render the same sequence differently.
A second reversal can restore the original code-point sequence, but that round trip alone does not show that the intermediate version preserved the intended emoji. Compare the actual output you plan to use with your chosen grouping rule and keep the original available for correction.