uri-encode-1.5.0.6: Unicode aware uri-encoding.

Safe HaskellSafe
LanguageHaskell2010

Network.URI.Encode

Description

Unicode aware URI encoding and decoding functions for both String and Text. Although standards are pretty vague about Unicode in URIs most browsers are pretty straightforward when encoding URIs: Encode a text to a UTF-8 string and URI-encode every individual byte (not character).

Synopsis

Documentation

encode :: String -> String Source #

URI encode a String, unicode aware.

encodeWith :: (Char -> Bool) -> String -> String Source #

URI encode a String, unicode aware, using the predicate to decide which characters are escaped (False means escape).

encodeText :: Text -> Text Source #

URI encode a Text, unicode aware.

encodeTextWith :: (Char -> Bool) -> Text -> Text Source #

URI encode a Text, unicode aware, using the predicate to decide which characters are escaped (False means escape).

encodeTextToBS :: Text -> ByteString Source #

URI encode a Text into a ByteString, unicode aware.

encodeTextToBSWith :: (Char -> Bool) -> Text -> ByteString Source #

URI encode a Text into a ByteString, unicode aware, using the predicate to decide which characters are escaped (False means escape).

encodeByteString :: ByteString -> ByteString Source #

URI encode a UTF8-encoded ByteString into a ByteString, unicode aware.

encodeByteStringWith :: (Char -> Bool) -> ByteString -> ByteString Source #

URI encode a UTF8-encoded 'ByteString into a ByteString, unicode aware, using the predicate to decide which characters are escaped (False means escape).

decode :: String -> String Source #

URI decode a String, unicode aware.

decodeText :: Text -> Text Source #

URI decode a Text, unicode aware.

decodeBSToText :: ByteString -> Text Source #

URI decode a ByteString into a Text, unicode aware.

decodeByteString :: ByteString -> ByteString Source #

URI decode a ByteString into a UTF8-encoded ByteString, unicode aware.

isAllowed :: Char -> Bool Source #

Is a character allowed in a URI. Only ASCII alphabetic characters, decimal digits, and - _ . ~ are allowed. This is following RFC 3986.