Saltar al contenido
uencoder

Especificación Punycode RFC 3492

El Punycode algoritmo codificación internationalized domain nombre etiquetas en ASCII.

Algorithm Overview

Punycode is a bootstrap encoding that converts a sequence of Unicode code points into a string of ASCII characters suitable for the Domain Name System. It separates basic ASCII code points, which are copied verbatim, from non-basic code points, which are encoded using a generalized variable-length integer scheme. The output is prefixed with the basic characters, a hyphen delimiter, and the extended encoding. This keeps purely ASCII labels unchanged when no non-basic characters are present.

basic code points
ASCII 0-127 copied directly to output
abc stays abc
delimiter
Hyphen separates basic from extended part
xn--abc-...
base 36
Extended integers encoded in base 36 with bias
digits and letters
ACE prefix
xn-- marks a Punycode label
xn--mnchen-3ya

Bias Adaptation

The variable-length integer encoding uses a dynamic bias that adapts after each inserted code point to keep the output short for typical inputs. The bias starts at 72 and is adjusted by a delta value after each insertion. This adaptation makes Punycode output compact for common domain names while remaining unambiguous. The decoder reverses the process by applying the same bias updates in sequence.

IDN Integration

RFC 3490 wraps Punycode in the Internationalized Domain Name (IDN) protocol, applying nameprep and Punycode to each label. A label containing non-ASCII characters is transformed to its ACE form starting with xn-- for DNS lookup. Applications display the original Unicode form to users while resolving the ASCII form on the wire. Mismatched nameprep versions between client and server can cause resolution failures.

Herramientas relacionadas

参考链接