GUIDES / Invisible characters
Hidden characters in Arabic text: how to find and remove them
Some characters take up no space on screen, yet they reorder a line, break a search or get your text rejected by a form. Arabic text picks them up easily, especially when it is copied. This guide covers the symptoms, what each character does, how to see them in the Invisible text inspector, and how to remove only the ones you do not want.
Signs that your text is hiding something
An invisible character has no shape, so you notice it only by what it does. These are the usual symptoms:
- Punctuation or numbers on the wrong side. A full stop, bracket or number lands at the wrong end of the line, or a phone number displays in a strange order. Direction marks and embeddings move neutral characters such as punctuation and spaces.
- A space that will not delete. Backspace seems to do nothing, because the first press removed an invisible character. Or a double space survives collapsing, because one of the two is a no-break space.
- Identical words that do not match. A search, an Excel lookup or a duplicate check treats two copies of a name as different, because one carries a character you cannot see.
- A username, email address or file name that gets rejected even though it looks exactly right.
- Pasted text that behaves oddly compared with the same words typed by hand, after copying from a chat app, a web page or a document.
Unicode designed direction controls to affect display, not comparison. But many search boxes, spreadsheets and login forms compare the stored characters one by one, so one extra character makes two strings different. If the only problem is order, the cause may be the paragraph direction rather than a hidden character; the first section of the reversed Arabic guide shows how to tell.
The hidden characters you will meet in Arabic text
These are the characters that turn up most in Arabic text. Each has a fixed code point, which is what the inspector reports.
| Character | Code point | What it does | Remove it? |
|---|---|---|---|
| Direction marks RLM, LRM, ALM | U+200F, U+200E, U+061C | Act like an invisible right-to-left, left-to-right or Arabic letter, pulling punctuation and numbers to one side. | Usually, in pasted text. Keep deliberate ones. |
| Embeddings and overrides LRE, RLE, LRO, RLO, closed by PDF | U+202A–U+202E | Force a direction on a stretch of text. An override displays characters in a different order from the stored one. | Yes, in most pasted text. |
| Isolates LRI, RLI, FSI, closed by PDI | U+2066–U+2069 | Wall off a run, such as an English name or a number, from the sentence around it. | Only if you do not need them. |
| Zero width non-joiner, ZWNJ | U+200C | Stops two neighbouring letters from joining. | No, especially in Persian, Urdu and Kurdish. |
| Zero width joiner, ZWJ | U+200D | Asks for a joined form and binds several emoji into one. | No. |
| Zero width space, ZWSP | U+200B | Marks a possible line break without taking any width. | Usually, in Arabic text. |
| Byte order mark, BOM | U+FEFF | An encoding signature at the start of a file; inside text, a zero-width no-break space. | Yes, in pasted text and at the start of fields. |
| Word joiner, WJ | U+2060 | Prevents a line break at its position. | Rare; leave it. |
| No-break spaces NBSP, NNBSP | U+00A0, U+202F | Look like a normal space but stop the line breaking there. | Convert to ordinary spaces. |
| Soft hyphen, SHY | U+00AD | Marks where a word may be hyphenated; normally not shown. | Yes. |
UAX #9, the Unicode Bidirectional Algorithm, explains the table. The marks are never displayed, yet they affect ordering as a letter would. The standard encourages isolates over embeddings in new documents, asks for overrides to be avoided wherever possible for security reasons, and prefers markup such as the HTML dir attribute on web pages.
Find them first: the Invisible text inspector
- Open Invisible text and paste the suspicious text, starting with one short line.
- Read the status line: Code points: … · characters to inspect: …. Ordinary spaces, tabs and line breaks are not counted there.
- Look at the preview. Each hidden character is replaced by a badge such as RLM, NBSP or ZWSP, so you can see where it sits.
- Check the table. It gives each character's position, code point, official name, bidi class and joining type. Positions start at 1, and code point and UTF-16 positions are listed separately, because one emoji can take two UTF-16 units.
- Tick Show all characters (first 300) to see everything, or open Copyable text report to share the findings.
RLMأحمدNBSPعليZWSP
- U+200F · RIGHT-TO-LEFT MARK · Position 1
- U+00A0 · NO-BREAK SPACE · Position 6
- U+200B · ZERO WIDTH SPACE · Position 10
Settings: Invisible text inspector · invisible characters only
Open the tool: Invisible textThis name, copied from a chat, looks ordinary but carries three characters you cannot see: a right-to-left mark at position 1, a no-break space instead of a normal space at position 6, and a zero-width space at position 10. Any one of them makes the name fail an exact match against «أحمد علي» typed by hand.
To read more about a code point, search for it in Characters, for example U+200F, or pick the Invisible & controls category. The inspector never changes your text.
Not every invisible character is junk
Before deleting anything, ask whether it was put there on purpose. It must stay in these cases:
- ZWNJ in Persian. Persian writes «میخواهم» and plurals such as «کتابها» with a ZWNJ that keeps the two parts unjoined without adding a space. The Unicode Standard cites the Persian plural suffix as an example and warns that dropping these characters changes the meaning. Urdu, Kurdish and other Arabic-script languages rely on it too.
- ZWJ in emoji. 👩🏽💻 is a woman, a skin tone, a ZWJ and a laptop. Without the ZWJ, the parts show as separate emoji.
- ZWJ in teaching material. It lets a letter show its joined form with no neighbour, as in alphabet lessons that display medial heh on its own.
- Deliberate direction marks. An editor may add an RLM to a subtitle or an app string to pin punctuation in place. If a line looks worse after removal, go back to the original.
میZWNJخواهم 👩🏽ZWJ💻
- U+200C · ZERO WIDTH NON-JOINER · Position 3
- U+200D · ZERO WIDTH JOINER · Position 12
Settings: Invisible text inspector · invisible characters only
Open the tool: Invisible textThe Cleaner's direction-control removal and its zero-width space option both leave ZWNJ and ZWJ alone. Below, only the two direction marks go; the non-joiner in the Persian word and the joiner in the emoji stay:
RLMمیZWNJخواهم 👩🏽ZWJ💻RLM
میZWNJخواهم 👩🏽ZWJ💻
Settings: Cleaner · Remove direction controls from result · Remove zero-width space & BOM
Open the tool: CleanerRemove only what you need, one option at a time
The Cleaner has a separate option for each family. Turn on only the one that matches what the inspector found.
| The inspector shows | Cleaner option | Where it is |
|---|---|---|
| LRM, RLM, ALM, embeddings, overrides and isolates | Remove direction controls from result | Inspect text direction panel, below the editor |
| ZWSP and BOM | Remove zero-width space & BOM | More controls › Targeted cleanup |
| NBSP and NNBSP | Convert non-breaking spaces to ordinary spaces | Spacing & line breaks |
| SHY | Remove soft hyphens | More controls › Targeted cleanup |
| ZWJ, ZWNJ and WJ | No option removes them; the joiners are kept on purpose | — |
RLMأحمدNBSPعليZWSP
أحمد علي
Settings: Cleaner · Remove direction controls from result · Convert non-breaking spaces · Remove zero-width space & BOM
Open the tool: CleanerThe name is now plain text with an ordinary space. Paste the result into the inspector again: it should read characters to inspect: 0.
The Inspect text direction panel also shows Hidden direction controls as badges, and its Preview direction setting changes only the display, adding nothing to copied text. After removing direction marks, reread any line that mixes Arabic, English, numbers and brackets.
Common cases and what to do
A login form rejects an email address or username
An address or username copied from a message or a web page may carry a direction mark at the start or a zero-width space inside. The form may refuse those characters, or treat them as part of the text and fail to find your account. Remove both and paste the result:
LRMahmed.aliZWSP@example.com
ahmed.ali@example.com
Settings: Cleaner · Remove direction controls from result · Remove zero-width space & BOM
Open the tool: CleanerExcel will not match two identical names
Microsoft notes that TRIM was designed for the ordinary space (code 32) and does not, by itself, remove the non-breaking space (code 160). CLEAN removes only control codes 0 to 31, so direction marks and zero-width spaces stay. Clean the column in the Cleaner before pasting it into the sheet, or check one cell in the inspector.
The first column of a CSV file cannot be found
If a program reads a UTF-8 CSV saved with a BOM without expecting one, the first column name starts with U+FEFF and a lookup for «الاسم» fails. The Unicode FAQ notes that some recipients of UTF-8 data do not expect a BOM, and that two fields can hold the same content without being binary-equal. Remove zero-width space & BOM deletes it from pasted text.
BOMالاسم,المدينة- U+FEFF · ZERO WIDTH NO-BREAK SPACE · Position 1
Settings: Invisible text inspector · invisible characters only
Open the tool: Invisible textA double space that will not go away
Collapse spaces and tabs handles ordinary spaces and tabs only, so a no-break space keeps the gap open. Add Convert non-breaking spaces:
السعرNBSP 25NBSPد.ك
السعر 25 د.ك
Settings: Cleaner · Collapse spaces and tabs · Convert non-breaking spaces
Open the tool: CleanerPunctuation is still on the wrong side
If the inspector finds nothing, the paragraph direction is the problem. Set the paragraph to right-to-left in your app, or compare with Preview direction in the Inspect text direction panel. For the full routine after pasting, read cleaning copied Arabic text.
Frequently asked questions
How can I tell whether text contains invisible characters?
Paste it into Invisible text. If characters to inspect is above 0, the preview shows a badge for each one. A quick hint without any tool: if moving the cursor through a word takes an extra key press, something invisible is there.
Is it safe to remove all direction marks?
In pasted text it usually is, but reread lines that mix Arabic, English and numbers afterwards. Keep marks an editor added on purpose in subtitles or app strings. ZWNJ and ZWJ are not direction marks, and the Cleaner does not remove them.
Why is there still a double space after collapsing spaces?
One of the two is a no-break space, U+00A0, and space collapsing only handles ordinary spaces and tabs. Turn on Convert non-breaking spaces as well.
What is ZERO WIDTH NO-BREAK SPACE in my report?
It is the official name of U+FEFF, better known as the byte order mark. At the start of a file it is an encoding signature; inside text it prevents a line break without showing anything. Unicode prefers U+2060 for that second job. Remove it with Remove zero-width space & BOM.
Why does pressing Backspace seem to do nothing?
You are deleting an invisible character that sits before the letter or space. Press again, or clean the whole text in the Cleaner.
Is my text sent to a server?
No. The inspector and the Cleaner run in your browser and do not send your text anywhere. See the privacy page for details.
Tools used in this guide
Sources
We checked these pages when writing and updating this guide.
Unicode Standard Annex #9: Unicode Bidirectional Algorithm ↗Unicode FAQ: Bidirectional text ↗Unicode code chart: General Punctuation (U+2000–U+206F) ↗Unicode code chart: Latin-1 Supplement (no-break space, soft hyphen) ↗The Unicode Standard, chapter 23: Special Areas and Format Characters ↗The Unicode Standard, chapter 9: West Asia-I (Arabic joiner and non-joiner) ↗Unicode FAQ: UTF-8, UTF-16, UTF-32 and BOM ↗Unicode Technical Standard #51: Unicode Emoji ↗Microsoft Support: TRIM function ↗Microsoft Support: CLEAN function ↗