Docs / Unicode text

Unicode text

Two strings that look identical on screen can differ in several ways a program notices and a person does not. The letter é can be one code point or two, a plain letter followed by a combining accent. A space can be an ordinary space, a non-breaking space or one of a dozen other spaces. A zero-width space or a directional mark can sit inside a word without changing how it looks, and a Cyrillic а is indistinguishable from a Latin a in most fonts.

Those differences explain a large share of the bugs in this area: a search that misses a name, two usernames that collide, an identifier that fails validation after being copied from a PDF, a length limit that cuts an emoji in half. Length itself has at least four answers. A family emoji can be one character to a reader, several code points, a larger number of UTF-16 units in JavaScript and more bytes again in UTF-8.

The endpoints in this group make those layers visible. They normalise to NFC, NFD, NFKC or NFKD and show what changed, list every code point with its name, point out invisible and bidirectional control characters, and flag confusable characters using the Unicode security mechanisms of UTS #39.

Transliteration from Cyrillic is offered in three systems, ISO 9, GOST 7.79 and the Russian passport rules, because they produce different Latin spellings of the same name. Byte encodings can be detected, which is always a guess, and converted.

Every endpoint in this group

/text/normalize?text=&form=

Unicode normalisation NFC, NFD, NFKC or NFKD

text: text; form: NFC, NFD, NFKC or NFKD

curl "https://agent-helper.org/text/normalize?text=%EF%AC%81%20cafe%CC%81&form=NFKC"

/text/codepoints?text=

Every character with code point, name and category

text: text, up to 500 characters

curl "https://agent-helper.org/text/codepoints?text=A%20e%CC%81%20%F0%9F%98%80"

/text/char/{char}

Properties of one character (by U+XXXX, hex, or the character itself)

char: U+1F600, 1F600, or a single character

curl "https://agent-helper.org/text/char/U+1F600"

/text/invisible?text=

Find invisible, bidi-control, tag and non-standard space characters

text: text

curl "https://agent-helper.org/text/invisible?text=pay%E2%80%8Bpal%E2%80%AEtxt.exe"

/text/confusables?text=

Characters that look like others (homoglyphs) and mixed scripts

text: text, e.g. a domain or username

curl "https://agent-helper.org/text/confusables?text=p%D0%B0ypal"

/text/confusable?a=&b=

Whether two strings are visually confusable (same UTS #39 skeleton)

a: first string; b: second string

curl "https://agent-helper.org/text/confusable?a=paypal&b=p%D0%B0ypal"

/text/length?text=

Length in code points, grapheme clusters, UTF-8 bytes and UTF-16 units

text: text

curl "https://agent-helper.org/text/length?text=%F0%9F%91%A9%E2%80%8D%F0%9F%91%A9%E2%80%8D%F0%9F%91%A7%20e%CC%81"

/text/translit?text=&system=

Transliterate Cyrillic to Latin: ISO 9, GOST 7.79 B, Russian passport

text: text; system: iso9, gost-b or passport

curl "https://agent-helper.org/text/translit?text=%D0%A9%D1%83%D0%BA%D0%B8%D0%BD%20%D0%AE%D1%80%D0%B8%D0%B9&system=passport"

/text/slug?text=&[translit=]&[separator=]&[max_length=]

URL slug from text, with explicit transliteration

text: text; translit (optional): iso9, gost-b, passport or none; separator (optional): separator; max_length (optional): 0 for no limit

curl "https://agent-helper.org/text/slug?text=%D0%9F%D1%80%D0%B8%D0%B2%D0%B5%D1%82%2C%20%D0%BC%D0%B8%D1%80!%20Caf%C3%A9"

/text/detect-encoding?[hex=]&[b64=]

Guess the character encoding of bytes (charset-normalizer)

hex (optional): input bytes as hex, instead of text; b64 (optional): input bytes as base64, instead of text ('+' is kept literally)

curl "https://agent-helper.org/text/detect-encoding?hex=cff0e8e2e5f220ece8f02c20fdf2ee20f2e5f1f220eaeee4e8f0eee2eae8"

/text/transcode?from=&[hex=]&[b64=]&[to=]

Convert bytes from one encoding to another (result as base64 and text preview)

hex (optional): input bytes as hex, instead of text; b64 (optional): input bytes as base64, instead of text ('+' is kept literally); from: source encoding, e.g. cp1251; to (optional): target encoding

curl "https://agent-helper.org/text/transcode?hex=cff0e8e2e5f2&from=cp1251"