Character and Encoding Inspector

Find the invisible, bidirectional and unusual characters hiding in a text, and clean them out.

How to use

What it checks and how it works

The tool lists each code point in the text with its U+ number, its UTF-8 bytes, its Unicode general category, read from the JavaScript engine's own Unicode tables, and, for invisible, format, space and bidirectional control characters, a name and a kind. Names are bundled only for those characters. For any other character the table gives the general category and not a Unicode character name. Bidirectional classes and controls follow Unicode Standard Annex #9, using the bidi-js package, and unbalanced controls are reported. Unterminated bidirectional controls in source code are the basis of the Trojan Source attack described at trojansource.codes (CVE-2021-42574). The text can be shown with unusual characters tagged, written with Unicode escapes, or cleaned. Cleaning can keep the zero-width non-joiner and joiner, which Arabic and Persian writing use. The tool can also try to repair mojibake, text decoded in the wrong encoding, by reading it as windows-1252 bytes and decoding those bytes as UTF-8, as the WHATWG Encoding Standard defines. Limits: a repair is a guess to check by eye, and the tool does not normalize or spell-check text. When you ask to see every character, a maximum of 300 are listed.

What are invisible characters and why do they matter?

They are code points that print nothing, such as zero-width spaces and bidirectional controls. They can break matching, URLs and code, and the Trojan Source research shows they can hide in source code.

Should I remove the zero-width joiners from Arabic text?

Not always. The zero-width non-joiner and joiner are used in Arabic and Persian writing, so the tool lets you keep them when cleaning.

What is mojibake?

It is text that was decoded with the wrong encoding, so Arabic appears as strings like العربية. The repair re-reads it as windows-1252 bytes and decodes them as UTF-8.

Sources

Related tools

Privacy

Runs in your browser; nothing is uploaded. The interactive tool needs JavaScript.