utf8-string- Support for reading and writing UTF8 Strings

Copyright(c) Eric Mertens 2007
LicenseBSD3-style (see LICENSE)
Safe HaskellTrustworthy



Support for encoding UTF8 Strings to and from [Word8]



encode :: String -> [Word8] Source

Encode a Haskell String to a list of Word8 values, in UTF8 format.

decode :: [Word8] -> String Source

Decode a UTF8 string packed into a list of Word8 values, directly to String

encodeString :: String -> String Source

Encode a string using encode and store the result in a String.

decodeString :: String -> String Source

Decode a string using decode using a String as input. | This is not safe but it is necessary if UTF-8 encoded text | has been loaded into a String prior to being decoded.

encodeChar :: Char -> [Word8] Source

Encode a single Haskell Char to a list of Word8 values, in UTF8 format.

isUTF8Encoded :: String -> Bool Source

isUTF8Encoded str tries to recognize input string as being in UTF-8 form.

utf8Encode :: String -> String Source

utf8Encode str is a convenience function; checks to see if str isn't UTF-8 encoded before doing so. Sometimes useful, but you are better off keeping track of the encoding so as to avoid the cost of checking.