Next Previous Contents

7.2 The WideString library

With the notable exception of HBC, Haskell systems represent characters internally via 8-bit bytes and not with wider formats capable of holding Unicode characters in raw form (16-bit or more). To help users on these imparied systems interface with the external world that expect ``wide strings'', the WideString library can be used. It provides the following:

newtype WideString -- abstract

nullWideString       :: WideString
stringToWide         :: String     -> IO WideString
wideToStr            :: WideString -> IO String
wideStringLen        :: String     -> Word32
word16ToWideString   :: Word16 -> IO WideString

lengthWideString     :: WideString -> Int

marshallWideString   :: WideString -> IO Addr
unmarshallWideString :: Ptr WideString -> IO WideString
writeWideString      :: Ptr WideString -> WideString -> IO ()
readWideString       :: Ptr WideString -> IO WideString
freeWideString       :: Ptr WideString -> IO ()
sizeofWideString     :: Word32

Notice that WideStrings are not currently finalised for you by the garbage collector, so you have to release them explicitly.


Next Previous Contents