[Haskell-cafe] Re: Writing binary files?

MR K P SCHUPKE k.schupke at imperial.ac.uk
Thu Sep 16 05:57:53 EDT 2004

>E.g. what happens if you call getDirectoryContents for a directory
>which contains filenames which aren't valid in the current encoding?

Surely this shows the problem with the idea of a 'current encoding'
... You could be reading files from two remote servers each using
different encodings...

So you could have read and write raw [Word8] and read and write char,
somehting like:

        readWithEncoder :: ([Word8] -> [Char]) -> IO [Char]
        writeWithEncoder :: ([Char] -> [Word8]) -> [Char] -> IO ()

After all, how can you 'normalise' a filename to a standard encoding
if you don't have a function to do so. Infact if you encounter
a server with an encoding you have no converter for, you have no
choice but to treat it as raw bytes?


More information about the Haskell-Cafe mailing list