Emojis in URLs and Domain Names: Punycode and the IDN System
An emoji domain is an ASCII string in disguise. Here is how Punycode and percent encoding make emoji URLs work through old infrastructure. Emoji domains are a curiosity that occasionally goes viral, but the mechanism behind them is a real piece of internet infrastructure called Punycode. When you see a URL with an emoji in the domain, the emoji is not actually in the DNS. It is an encoded ASCII string that the browser decodes back to the emoji for display. Understanding how this works is useful even if you never register an emoji domain, because the same encoding governs internationalized domain names in every script. I first encountered Punycode when debugging why a URL with a Chinese domain name was resolving correctly in the browser but failing in a command-line tool. The browser was decoding the Punycode back to the Chinese characters for display, while the command-line tool was using the raw ASCII Punycode. Both were correct, but the difference in display was confusing. The same mechanism applies to emoji domains. Internationalized Domain Names and IDN The Domain Name System was originally ASCII only. Letters, digits, and hyphens, nothing else. When the internet needed to support domain names in Chinese, Arabic, Cyrillic, and other scripts, the IETF defined Internationalized Domain Names, a system that encodes non-ASCII labels into ASCII using an algorithm called Punycode. The encoded form is prefixed with xn. Read the full article on Emoji Reference, and copy any emoji mentioned from the catalog of 1303+ entries on the home page.