DEV Community

owen
owen

Posted on

There's no superscript "q" in Unicode — and other things I learned building a superscript generator

Quick quiz: how do you write "x² + y³" in plain text, no HTML, no LaTeX?

 Easy, right? `²` and `³` are just characters. Now write "E = mcᵠ" — wait, that should be a superscript "q". Try to find it. I'll wait.

 You won't, because **Unicode has no superscript q**. When I built a [free superscript converter](https://literalkit.com/superscript-generator), this turned out to be the tip of
Enter fullscreen mode Exit fullscreen mode

a very weird iceberg. Here's what I learned.

Superscripts aren't formatting — they're separate characters

 Most people assume superscript works like bold: take a character, apply a style. That's how `<sup>` works in HTML, and how rich text editors work.

 Unicode plain text doesn't have styles. Instead, every superscript character is its own pre-composed codepoint, donated to the standard by different communities at different
Enter fullscreen mode Exit fullscreen mode

times:

 - `¹²³` live in **Latin-1 Supplement** (U+00B9, U+00B2, U+00B3) — they've been there since the 1980s.
 - `⁰ ⁴-⁹ ⁺ ⁻ ⁽ ⁾` live in the **Superscripts and Subscripts** block (U+2070–U+209F).
 - Superscript *letters* are scattered across **Phonetic Extensions** (U+1D2C–U+1D7F), because linguists needed them for phonetic transcription: `ᵃ ᵇ ᶜ ᵈ ᵉ ᶠ ᵍ ʰ ...`
 - And a few stragglers like `ˣ` (U+02E3) hide in **Spacing Modifier Letters**.

 So "convert text to superscript" really means "look up each character in a hand-built mapping table someone assembled from four different corners of the standard." There's no
Enter fullscreen mode Exit fullscreen mode

algorithm. It's a scavenger hunt.

The honest-output problem

 Here's where it gets philosophically interesting. The mapping has holes:

 - **No superscript `q`.** It's the famous gap. Proposals exist, but as of today there's no official codepoint.
 - **Uppercase letters are incomplete** — you get `ᴬ ᴮ ᴰ ᴱ ᴳ ᴴ ᴵ ᴶ ᴷ ᴸ ᴹ ᴺ ᴼ ᴾ ᴿ ᵀ ᵁ ⱽ ᵂ`, but try spelling a full sentence in superscript caps and you'll hit walls fast.
 - Subscripts are even sparser: `ₐ ₑ ₕ ᵢ ⱼ ₖ ₗ ₘ ₙ ₒ ₚ ᵣ ₛ ₜ ᵤ ᵥ ₓ` — that's most of what exists.

 Most converters on the web quietly patch the holes with **lookalike characters** — a Greek letter here, a math alphanumeric symbol there. The output *looks* fine until someone
Enter fullscreen mode Exit fullscreen mode

copies it into a screen reader, a search box, or a font that renders the substitute as tofu (□).

 I made a different call: when a character has no real superscript, the tool says so instead of faking it. It feels worse in the demo and better in real life — what you copy is
Enter fullscreen mode Exit fullscreen mode

what you meant.

Top comments (0)