About

Tool No. 72 of Pikkola

A text file is a sequence of numbers, and the numbers do not always say what a reader sees. This page opens the gap in both directions: what a cluster looks like, and what each code point behind it is, with the bytes and the escapes that a program would use.

What it does

How a character is read

The page never asks a library what a character is. It reads the code point and asks three questions of the browser's own Unicode data: the general category, through a regular expression property; the script and the block, through the ranges in this page; and the UTF-8 and UTF-16 forms, which are arithmetic. The same numbers therefore appear whether the page is online or not, and no part of a private text is sent to a service to be named.

Names are different, because JavaScript does not expose the Unicode name table. The page carries a table of its own: all of ASCII, the Latin, Greek and Cyrillic letters, Hiragana and Katakana, Hangul letters and syllables, the combining marks and the format characters that matter to the hidden bench, and the emoji that appear most often. Hangul syllable names and CJK ideograph names follow the algorithms Unicode defines, so any syllable or ideograph is named correctly even though no table lists it. A character outside the table shows its block and code point instead of a name, which is honest about what the page knows.

What a grapheme cluster is for

A grapheme cluster is a unit a reader treats as one character. It can be one code point, or several joined by zero-width joiners, combining marks or variation selectors. Counting them separately from code points is the point of the first bench: a field that allows 20 characters may allow 20 graphemes and 60 code points, and a database column sized in bytes will overflow sooner than either.

The split uses the browser's own segmenter where it exists, and a smaller rule set where it does not. The fallback joins a base with the marks and variation selectors that follow it, keeps an emoji modifier with its base, and keeps a zero-width joiner sequence together. It is close to the standard, and the page does not claim more than that.

Invisible characters

Zero-width spaces, bidi controls and tag characters are legal Unicode, not damage. That is what makes them useful in an attack: a file with a right-to-left override passes a review, a diff and a copy and paste, and the code that runs is not the code a reviewer read. The hidden bench lists each one with its context so the reading can be checked by eye, not only trusted.

Some of these characters are normal in the right place. A zero-width joiner holds an emoji family together; a zero-width non-joiner is required in Persian and in some Indic writing; a variation selector chooses between a text and an emoji heart. They are reported as notes rather than errors for that reason, and the cleanup leaves joiners and variation selectors in place unless you ask for them.

Lookalike letters

A Cyrillic а and a Latin a are different code points that most fonts draw the same way. The page flags a lookalike when it sits in a word that also has an ASCII Latin letter, which is the case in a forged domain such as аpple.com. It also flags fullwidth and mathematical letters, because a normalization would turn them into Latin and a reader may not notice the width. A word written entirely in lookalike Cyrillic is not flagged: nothing in the text says which alphabet was meant, and a guess would be wrong for every Russian word.

Normalization

NFC and NFD are canonical: they change the code points without changing what a reader sees. NFKC and NFKD also fold compatibility characters, so a fullwidth A becomes an A, a ligature becomes two letters, and the Kelvin sign becomes K. That is useful before a search, and wrong before a password or a display name.

Korean is the case that catches people. macOS writes some file names in NFD, where each syllable is its jamo in order. The bytes differ from the same name typed on Windows or stored in a database, and a string comparison says they are different while the screen says they are the same. The normalizer shows the four forms with their code points and composes the decomposed text on request.

Where the limits are

Why it is free

Pikkola builds small tools with one job each and keeps them free, with no account and no lock on the result. A static page that works in the browser costs almost nothing to serve, so there is no reason to charge for it or to watch who uses it.

Contact

A character the page names wrongly, a kind it misses, a Korean or Japanese sentence that reads badly: hello@pikkola.com. The code point and the text around it are the most useful things to send.

Back to the studio