http-encodings-0.9: A library for encoding and decoding bodies of HTTP messages

Safe HaskellNone
LanguageHaskell2010

Network.HTTP.Encoding.Character

Description

Detection and of character encodings of HTTP message bodies

Synopsis

Documentation

getContentTypeAndCharacterEncoding :: [Header] -> (Maybe Type, Maybe EncodingName) Source

Looks for and parses the ContentType header. Returns the (optional) content-type and (optional) the character encoding name.

setCharacterEncoding :: EncodingName -> [Header] -> [Header] Source

Sets the given character encoding name in the given header. If there is no content type header in the header list, it defaults to the text/plain content type

tryAsUTF8 :: ByteString -> Maybe String Source

Tries to decode a bytestring as UTF-8. Returns nothing if any illegal characters are encountered