Safe Haskell | None |
---|---|
Language | Haskell98 |
Data.Text.IDN.Punycode
Description
Punycode is a simple and efficient transfer encoding syntax designed for use with Internationalized Domain Names in Applications (IDNA). It uniquely and reversibly transforms a Unicode string into ASCII. ASCII characters in the Unicode string are represented literally, and non-ASCII characters are represented by ASCII characters that are allowed in host name labels (letters, digits, and hyphens).
Documentation
encode :: Text -> Maybe (Integer -> Bool) -> ByteString Source
Encode unicode into an ASCII-only ByteString
. If provided, the
case predicate indicates whether to uppercase the corresponding character
after decoding.
decode :: ByteString -> Maybe (Text, Integer -> Bool) Source
Decode a ByteString
into unicode. The second component of the
result is a case predicate; it indicates whether a particular character
position of the result string should be upper-cased.
Returns Nothing
if the input is invalid.