Minimal Punycode implementation for IDN hostname validation. Based on RFC 3492: https://www.rfc-editor.org/rfc/rfc3492
This implementation provides encode/decode functions sufficient for validating internationalized domain names without requiring the full :idna library.
Summary
Functions
Decode a punycode string to a unicode charlist.
Raises ArgumentError if the punycode is invalid or decodes to characters that are not valid for domain names (control characters, code points above Unicode range, etc.).
Examples
iex> Exonerate.Formats.Punycode.decode(~c"bcher-kva")
~c"bücher"
iex> Exonerate.Formats.Punycode.decode(~c"Mnchen-3ya")
~c"München"
Encode a unicode charlist to punycode.
Examples
iex> Exonerate.Formats.Punycode.encode(~c"bücher")
~c"bcher-kva"
iex> Exonerate.Formats.Punycode.encode(~c"München")
~c"Mnchen-3ya"