Internationalized domain names (IDNA2008, RFC 5890–5893): conversion
between U-labels (bücher.example) and A-labels
(xn--bcher-kva.example), and their validation.
iex> Sovite.IDNA.to_ascii("Bücher.example")
{:ok, "xn--bcher-kva.example"}
iex> Sovite.IDNA.to_unicode("xn--bcher-kva.example")
{:ok, "bücher.example"}
iex> Sovite.IDNA.to_ascii("xn--bcher-kva.example")
{:ok, "xn--bcher-kva.example"}to_ascii/1 maps its input first, as RFC 5895 suggests for names
people type: it is lower-cased, normalized to NFC, and the ideographic
full stops (。, ., 。) separate labels like .. Every label must
then be an LDH label (letters, digits, and hyphens), an A-label whose
decoding is a valid U-label, or a valid U-label: only code points
IDNA2008 allows (see Sovite.IDNA.CodePoints), in NFC, not starting
with a combining mark, without -- in the third and fourth positions,
and following the contextual rules and, in domains with right-to-left
labels, the Bidi rule. Results are lower-case.
A-labels are at most 63 octets, and the whole name in A-labels at most 253 octets. A trailing dot (the DNS root) is not accepted.
Summary
Functions
Whether name has A-labels or non-ASCII characters, so it is
internationalized.
Converts a domain name to A-labels.
Converts a domain name to U-labels, checking it as to_ascii/1 does.
Whether name is a valid domain name in either form.
Types
Functions
Whether name has A-labels or non-ASCII characters, so it is
internationalized.
Converts a domain name to A-labels.
Converts a domain name to U-labels, checking it as to_ascii/1 does.
Whether name is a valid domain name in either form.
iex> Sovite.IDNA.valid?("münchen.example")
true
iex> Sovite.IDNA.valid?("a b.example")
false