Safe Haskell | None |
---|---|
Language | Haskell2010 |
Detection and of character encodings of HTTP message bodies
- getContentTypeAndCharacterEncoding :: [Header] -> (Maybe Type, Maybe EncodingName)
- setCharacterEncoding :: EncodingName -> [Header] -> [Header]
- tryAsUTF8 :: ByteString -> Maybe String
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