[Haskell-cafe] File path programme

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Sun Jan 30 15:25:00 EST 2005


David Roundy <droundy at abridgegame.org> writes:

> No, it's not Unix-specific, it's portable. If you want to write
> portable C code, you have to use the standard library, which means
> that file names are represented as Ptr CChar.

I disagree. We are talking about portable Haskell, not portable C.

The native Windows filename encoding (in WinNT) is UTF-16 (without
validation that surrogates are correctly paired). It provides API
which works with such filenames.

It also provides a compatibility layer on top of that, which tries
to translate filenames to some 8-bit encoding, but it should only be
used when porting C programs which can't be adapted to use Windows
filenames through their native type. Especially as Haskell already
uses Unicode - it's pointless to convert it to an 8-bit encoding and
back.

I don't know what these 8-bit WinAPI functions do when they encounter
filenames unrepresentable in the current 8-bit encoding.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/


More information about the Haskell-Cafe mailing list