gnuidn-0.2.1: Bindings for GNU IDN

Safe HaskellNone

Data.Text.IDN.IDNA

Synopsis

Documentation

data Flags Source

Constructors

Flags 

Fields

verifySTD3 :: Bool

Check output to make sure it is a STD3-conforming host name

allowUnassigned :: Bool

Allow unassigned Unicode code points

Instances

data Error Source

Instances

defaultFlags :: FlagsSource

defaultFlags = Flags True False

toASCII :: Flags -> Text -> Either Error ByteStringSource

Convert a Unicode domain name to an ASCII ByteString. The domain name may contain several labels, separated by periods.

toASCII never alters a sequence of code points that are all in the ASCII range to begin with (although it could fail). Applying toASCII multiple times gives the same result as applying it once.

toUnicode :: Flags -> ByteString -> TextSource

Convert a possibly ACE-encoded domain name to Unicode. The domain name may contain several labels, separated by dots.

Aside from memory allocation failure, toUnicode always succeeds. If the input cannot be decoded, it is returned unchanged.