utf8-light-0.4.1: Unicode

Portabilityportable
Stabilityprovisional
MaintainerMatt Morrow <mjm2002@gmail.com>
Safe HaskellNone

Codec.Binary.UTF8.Light

Description

Lightweight UTF8 handling.

Synopsis

Documentation

class UTF8 a whereSource

Instances: ByteString, String , [Word32], [Word] , [Int32], [Int]

lenUTF8 :: Word8 -> IntSource

Length in Word8s

lenUTF16 :: Word16 -> IntSource

Length in Word16s

countUTF8 :: ByteString -> [Int]Source

Lengths in Word8s

encodeUTF8' :: [Word32] -> [[Word8]]Source

Word32s not representing valid UTF8 chars are dropped.

withUTF8 :: UTF8 a => a -> (ByteString -> b) -> bSource

putUTF8 :: UTF8 a => a -> IO ()Source

putUTF8Ln :: UTF8 a => a -> IO ()Source

hPutUTF8 :: UTF8 a => Handle -> a -> IO ()Source

hPutUTF8Ln :: UTF8 a => Handle -> a -> IO ()Source

writeUTF8File :: UTF8 a => FilePath -> a -> IO ()Source

hGetUTF8 :: UTF8 a => Handle -> Int -> IO aSource

Be careful that you're sure you're not chopping a UTF8 char in two!

hGetUTF8NonBlocking :: UTF8 a => Handle -> Int -> IO aSource

Same warning as for hGetUTF8

flipUTF8 :: UTF8 a => a -> aSource

 ghci> putUTF8Ln $ flipUTF8 "[?np_bs!]"
 [¡sq‾bu¿

unflipUTF8 :: UTF8 a => a -> aSource

 ghci> putUTF8Ln $ (unflipUTF8 . flipUTF8) "[?np_bs!]"
 [?np_bs!]

data Int8

8-bit signed integer type

data Int16

16-bit signed integer type

data Int32

32-bit signed integer type

data Word

A Word is an unsigned integral type, with the same size as Int.

data Word8

8-bit unsigned integer type