glidna/punycode

Values

pub fn from_ascii(domain: String) -> Result(String, Nil)

Takes a punycode encoding ascii string and returns the decoded unicode string or Error if the punycode is badly formed

Examples

from_ascii("mnchen-3ya")
// -> Ok("münchen")

from_ascii("n28h")
// -> Ok("😉")
pub fn to_ascii(domain: String) -> Result(String, Nil)

Encodes the passed unicode string to a valid punycode ascii string

Examples

to_ascii("münchen")
// -> Ok("mnchen-3ya")

to_ascii("😉")
// -> Ok("n28h")
Search Document