[Haskell-cafe] Writing binary files?
droundy at abridgegame.org
Sat Sep 18 07:36:47 EDT 2004
On Sat, Sep 18, 2004 at 10:58:21AM +0200, Marcin 'Qrczak' Kowalczyk wrote:
> Glynn Clements <glynn.clements at virgin.net> writes:
> >> Ok, but let it be in addition to, not instead treating them as
> >> character strings.
> > Provided that you know the encoding, nothing stops you converting them
> > to strings, should you have a need to do so.
> There are already APIs which use Strings for filenames. I meant to keep
> them, let them use a program-settable encoding which defaults to the
> locale encoding - this is the only sane interpretation of this interface
> on Unix I can imagine. And in addition to them we may have APIs which use
> byte strings, for those who prefer the ability to handle all filenames to
> using a uniform string representation inside the program.
Keep in mind, if you make this change to the IO libraries, you also will
have to simultaneously fix the Foreign.C.String module to use the same
locale as is used by the IO libraries when they deal with FilePaths.
Incidentally, this change will break existing darcs repositories... but
that should at least be repairable. According to the FFI the CString
functions do a locale-based conversion, but of course in practice that
isn't the case.
More information about the Haskell-Cafe