package idna
Module IdnaSource
Internationalized domain name validation, Punycode encoding/decoding, and Unicode NFC normalization.
Validates hostnames and labels per IDNA2008 (RFC 5890/5892). Handles A-labels (xn-- Punycode), U-labels (Unicode), and ASCII labels.
Check if a hostname is valid. Splits on dots, validates each label, enforces DNS length limits and domain-level bidirectional text rules.
Validate a single label (without dots). Decodes xn-- prefix if present. Checks codepoint validity, hyphen rules, NFC form, initial combining mark, bidirectional text, and CONTEXTJ/CONTEXTO rules.
Check bidirectional text rules across all labels in a domain. If any label contains right-to-left characters, all labels must satisfy bidirectional text constraints.
Normalize a codepoint sequence to Unicode NFC (Normalization Form C). Applies canonical decomposition, canonical ordering of combining marks, and canonical composition including Hangul syllables.
Convert a domain name to its ASCII-compatible form (UTS #46 Nontransitional). Maps, normalizes to NFC, splits on dots, validates, and Punycode-encodes non-ASCII labels. Returns the ASCII domain or an error.
Convert a domain name to its Unicode form (UTS #46 Nontransitional). Maps, normalizes to NFC, splits on dots, validates, and Punycode-decodes xn-- labels. Returns the Unicode domain or an error.