utf8-light-0.4.2: Unicode

Copyright(c) Matt Morrow 2008
LicenseBSD3
MaintainerMatt Morrow <mjm2002@gmail.com>
Stabilityprovisional
Portabilityportable
Safe HaskellNone
LanguageHaskell98

Codec.Binary.UTF8.Light

Description

Lightweight UTF8 handling.

Synopsis

Documentation

class UTF8 a where Source

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

lenUTF8 :: Word8 -> Int Source

Length in Word8s

lenUTF16 :: Word16 -> Int Source

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) -> b Source

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

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

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

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

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

Same warning as for hGetUTF8

flipUTF8 :: UTF8 a => a -> a Source

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

unflipUTF8 :: UTF8 a => a -> a Source

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

data Int8 :: *

8-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