How to Identify the Left-to-Right Override (U+202D) in Unicode

Learn what the Unicode Left-to-Right Override (U+202D) does, how to find it in text with code point, byte and script checks, and how to verify the result.

The Left-to-Right Override is an invisible Unicode formatting character. It changes the order in which text is displayed without changing the characters in the text. Because it has no visible glyph, you usually can't tell it is there by reading. This guide explains what the character does and how to identify it by code point, by bytes and with short scripts. It also covers how to confirm what you found before you change anything.

What the Left-to-Right Override does to your text

The Left-to-Right Override (LRO) is code point U+202D, with the official name LEFT-TO-RIGHT OVERRIDE. It is a bidirectional formatting control. Its general category is Cf (format), and its bidirectional class is LRO. The Unicode Bidirectional Algorithm decides display order for text that mixes left-to-right scripts such as Latin with right-to-left scripts such as Hebrew or Arabic. LRO tells that algorithm to ignore the usual directionality of the characters that follow and lay them out strictly left to right.

The override begins right after U+202D. It ends at the next matching U+202C POP DIRECTIONAL FORMATTING (PDF) or at the end of the paragraph, whichever comes first. The character changes only how text is displayed. The stored characters stay in the same order, so searching, sorting and comparing still use the underlying sequence. That is why text that looks identical on screen can fail an equality check or a search.

Illustrative example (not tested output): suppose a Hebrew word is wrapped in U+202D … U+202C inside an English sentence. Normally its letters would be shown right to left. With the override, they are shown left to right, so the word looks reversed to a Hebrew reader even though the stored letters are unchanged. With purely Latin text, LRO usually has no visible effect because those characters are already left-to-right.

Characters that are easy to confuse with LRO

Several invisible bidirectional controls look the same on screen because none of them is visible. Use the code point to tell them apart. The table lists the code point, UTF-8 bytes and role of each one.

Name | Code point | UTF-8 bytes | Role
LEFT-TO-RIGHT OVERRIDE (LRO) | U+202D | E2 80 AD | Forces following text to display left to right
RIGHT-TO-LEFT OVERRIDE (RLO) | U+202E | E2 80 AE | Forces following text to display right to left
POP DIRECTIONAL FORMATTING (PDF) | U+202C | E2 80 AC | Ends the most recent override or embedding
LEFT-TO-RIGHT EMBEDDING (LRE) | U+202A | E2 80 AA | Starts a left-to-right embedding without overriding character direction
RIGHT-TO-LEFT EMBEDDING (RLE) | U+202B | E2 80 AB | Starts a right-to-left embedding without overriding character direction
LEFT-TO-RIGHT ISOLATE (LRI) | U+2066 | E2 81 A6 | Starts an isolated left-to-right run
POP DIRECTIONAL ISOLATE (PDI) | U+2069 | E2 81 A9 | Ends an isolate
LEFT-TO-RIGHT MARK (LRM) | U+200E | E2 80 8E | Single directional mark that affects neighboring neutral characters; not an override

A common mix-up is between LRO and the Left-to-Right Mark. The mark (U+200E) works like an invisible strong left-to-right letter and does not open a range. The override (U+202D) opens a range that stays in effect until a PDF or the end of the paragraph. If you're looking specifically for LRO, match U+202D exactly rather than every invisible character.

Step 1: Check the code point directly

The most reliable test is to list every character's code point and look for U+202D. A Unicode inspector or character-info tool should report the code point, the name LEFT-TO-RIGHT OVERRIDE and the category Cf. If a tool shows only a blank or a generic placeholder, you can't be sure which character it is. Rely on the reported code point.

This Python script uses only the standard library. It prints the position, code point and name of every bidirectional control in a string. The sample string is an example. It contains an LRO after "abc" and a PDF after "def".

import unicodedata

BIDI_CONTROLS = {"LRE", "RLE", "LRO", "RLO", "PDF", "LRI", "RLI", "FSI", "PDI"}

text = "abc\u202Ddef\u202C"

for i, ch in enumerate(text):
    if unicodedata.bidirectional(ch) in BIDI_CONTROLS:
        print(i, f"U+{ord(ch):04X}", unicodedata.name(ch))

Based on the documented behavior of the unicodedata module, the expected output for this sample is shown below. Run it yourself to confirm it in your environment.

3 U+202D LEFT-TO-RIGHT OVERRIDE
7 U+202C POP DIRECTIONAL FORMATTING

Step 2: Search files by pattern or by bytes

To scan files, search for the code point with a Unicode-aware regular expression. If that isn't available, search for the UTF-8 byte sequence E2 80 AD. With GNU grep built with PCRE support and a UTF-8 locale, the first command below matches the code point. The second matches the raw bytes using Bash's $'…' quoting. Both print line numbers.

grep -nP '\x{202D}' file.txt

grep -n $'\xE2\x80\xAD' file.txt

To see the bytes themselves, dump the file one byte at a time and look for the sequence e2 80 ad. Tools that group bytes in pairs can split that sequence across two groups, so a one-byte-per-column format is easier to read.

od -An -tx1 file.txt

hexdump -C file.txt

Byte searches assume UTF-8. In a UTF-16 file the character is stored as the 16-bit unit 202D, which appears as 2D 20 in little-endian or 20 2D in big-endian. In HTML source it may appear as the character reference ‭ or ‭. Search for those forms too if your input might use them.

Step 3: Check strings in application code

In JavaScript, a regular expression with the \u escape finds the character in a string. The same pattern can be extended to cover all of the bidirectional controls listed above. The variable name is an example.

const hasLRO = /\u202D/.test(input);

const bidiControls = /[\u202A-\u202E\u2066-\u2069]/g;
const found = [...input.matchAll(bidiControls)].map(m => ({
  index: m.index,
  codePoint: "U+" + m[0].codePointAt(0).toString(16).toUpperCase()
}));

Why finding LRO matters in source code and user input

Override and embedding controls can make text display in an order that differs from how it is stored. In source code, this can make code look different from what a compiler or interpreter actually reads. Security researchers published this technique under the name Trojan Source. That is why many code review tools and editors now flag bidirectional controls. In user-supplied text such as file names or display names, a right-to-left override is the more common trick, because it can make part of a name appear reversed. LRO is often used together with RLO and PDF, so it's worth checking for the whole group.

Step 4: Verify before you remove anything

An LRO is not always a mistake. In right-to-left documents it may be deliberate, for example to keep a part number, code sample or Latin-script identifier in a fixed visual order. Before removing it, check whether the text still displays correctly without it. Removing it never changes the letters themselves, but it can change how a reader sees their order.

  • Record each match by position and code point, not just by line.
  • For each U+202D, find the U+202C that closes it. A PDF closes the most recent override or embedding, which might not be the LRO you are looking at.
  • If you remove an LRO, also remove its matching PDF so you don't leave an unmatched PDF that closes some other embedding.
  • After the change, rerun the same code point scan and confirm that U+202D no longer appears where you removed it.
  • Compare the stored text before and after. The only differences should be the control characters you meant to remove.

For new HTML content, the Unicode Standard recommends markup over these control characters where markup is available. The dir attribute, the bdo element, or the CSS property unicode-bidi with the value bidi-override provide the same forced direction and are visible in the source.

Limits of this guide

The code points, names, byte sequences and range behavior described here come from the Unicode Standard and its Bidirectional Algorithm. The command and script examples rely on documented tool behavior, but their outputs were not tested for this article. Editors, terminals and online inspectors also differ in how they show invisible formatting characters. Some show a placeholder, some show nothing, and some apply the override silently. Check what your own tool does with a known sample before relying on it.