UTF-8 library

Axel Simon A.Simon@ukc.ac.uk
Tue, 6 Aug 2002 13:46:56 +0100


On Tue, Aug 06, 2002 at 05:38:13AM -0700, John Meacham wrote:
> One major nit I have with this is the type signature of 
> decodeUTF8 and encodeUTF8
> a String should always represent a string of characters, not a byte
> stream, the signatures should be
> 
> decodeUTF8 :: String -> [Word8]
> encodeUTF8 :: [Word8] -> String
I guess that is a good point, but due to backwards compatibility this is 
propably not acceptable: The C interface of the FFI has the string 
functions:
peekCString :: CString -> IO String
newCString :: String -> IO CString

which should really be

peekCString :: CString -> IO [Word8]
newCString :: [Word8] -> IO CString

Unless that changes, there is really no point to give the encode and 
decode functions that type.

Axel.