Encoding and security guides
International domain names: Punycode and lookalike labels
Convert an internationalized hostname label and distinguish technical equivalence from domain trust.
Convert a hostname label
Punycode represents certain Unicode domain labels in ASCII. It is not percent encoding for a URL path or query.
The xn-- prefix identifies an ASCII-compatible encoded label; inspect the hostname separately from the surrounding URL.
bücher.example
→ xn--bcher-kva.exampleDo not encode the complete URL
A scheme, port, path and query have their own syntax. Punycode conversion belongs to domain labels, not the whole address.
Use URL Parser to extract the hostname and compare the browser-normalized address with the label conversion result.
Punycode alone is not all of IDNA
IDNA processing also handles permitted characters, mapping and validation. A standalone codec may not enforce every browser or registrar rule.
Test the complete hostname in the actual client. A reversible encoding result does not guarantee a registerable or resolvable domain.
Review domain identity explicitly
Different scripts can contain visually similar characters. Rendering a Unicode domain clearly does not prove it belongs to an expected publisher.
Compare the exact ASCII hostname against an allowlist when identity matters, and inspect certificates and the intended origin independently.