|Takusen-0.8.2: Database library with left-fold interface, for PostgreSQL, Oracle, SQLite, ODBC.||Contents||Index|
Marshall Haskell Strings to and from UTF8-encoded CStrings.
This module's code is inspired by John Meacham's UTF8 en- & de-coders,
and also those found in the HXT library (module Text.XML.HXT.DOM.Unicode).
Note that the -Len functions all return the length in bytes,
not Chars (this is more useful, as you are most likely to want
to pass the length to an FFI function, which is most likely
expecting the length in bytes). If you want the length in Chars,
well, you have the original String, so...
|peekUTF8String :: CString -> IO String|
|Analogous to peekCString. Converts UTF8 CString to String.
|peekUTF8StringLen :: CStringLen -> IO String|
|Analogous to peekCStringLen. Converts UTF8 CString to String.
The resulting String will end either when len bytes
have been converted, or when a NULL is found.
|newUTF8String :: String -> IO CString|
|Analogous to newCString. Creates UTF8 encoded CString.
|withUTF8String :: String -> (CString -> IO a) -> IO a|
|Analogous to withCString. Creates UTF8 encoded CString.
|withUTF8StringLen :: String -> (CStringLen -> IO a) -> IO a|
|Analogous to withCStringLen.
The length returned is in bytes (encoding units), not chars.
|toUTF8String :: String -> String|
|Convert a Haskell String into a UTF8 String, where each UTF8 byte
is represented by its Char equivalent i.e. only chars 0-255 are used.
The resulting String can be marshalled to CString directly i.e. with
a Latin-1 encoding.
|fromUTF8String :: String -> String|
|Convert a String that was marshalled from a CString without
any decoder applied. This might be useful if the client encoding
is unknown, and the user code must convert.
We assume that the UTF8 CString was marshalled as if Latin-1
i.e. all chars are in the range 0-255.
|lengthUTF8 :: String -> Int|
|fromUTF8 :: [Word8] -> String|
|Convert UTF-8 to Unicode.
|toUTF8 :: String -> [Word8]|
|Convert Unicode characters to UTF-8.
|Produced by Haddock version 0.7|