EN
Back to the archive

The encyclopedia · Software & IT · Technical decision · 2000-2003

Punycode encoded Unicode domain names as ASCII so unchanged DNS could carry them

Punycode reversibly mapped any Unicode label to ASCII hostname characters, so IDN needed no DNS protocol change.

IETF

the move

The DNS was built before the world drafted its names in anything other than ASCII. A label must consist of letters, digits and hyphens. So someone trying to register a name in Chinese, Arabic or Cyrillic simply could not, even though billions of people use those scripts.

The clumsy fix is to change the DNS itself, which would mean updating every resolver, server and application on the planet. Punycode took the other path: a reversible encoding that maps any Unicode string onto the ASCII characters DNS already accepts. IDNA then stores the result under the xn-- prefix, making it look like an ordinary label.

Because the encoding is ASCII-compatible, nothing in the core DNS had to change. Resolvers, caches and applications all kept working, and the world's scripts finally got domain names.

why it works

  • Punycode keeps the output within the ASCII letters, digits and hyphens DNS already allows, so the protocol is untouched.
  • It is reversible, so a resolver can map back and forth with no loss, making it safe for lookups and routing.
  • The xn-- prefix lets an application tell immediately that a label is an encoded internationalized name.
  • Because the encoding is compact, it fits the 63-character per-label limit that ASCII domains are bound by.
the payoffEncode Unicode back into ASCII that hostnames already allow.clever

what transfers

When a constraint blocks you, encode around it in the format the old system already accepts, rather than forcing the old system to change.

what came after

IDNA (RFC 3490 and its successors) built the application-layer rules around Punycode, and RFC 3492 documented the encoding in 2003. Internationalized domains became widely available, though the xn-- form leaks into user-visible URLs and IDN homograph abuse uses visually similar characters, which prompted stricter IDNA 2008 checks.

references

spotted an error? The archive wants to know.

same kind of clever