[Haskell] System.FilePath survey

Bulat Ziganshin bulatz at HotPOP.com
Fri Feb 3 08:08:25 EST 2006

Hello Krasimir,

Friday, February 03, 2006, 2:03:20 PM, you wrote:

KA>     * Do you think that we have to use unboxed arrays of Word8/Word16
KA> for file path?

utf8-encoded FastPackedString is much more appropriate

and about unicode filenames in windows - i have a library what
supports such filenames in NT/2000/XP systems. i plan to incorporate
this functionality in Standard Hierachical Libraries

AS> The task: Remove all files in a directory recursively.

AS> The problem: In case the current encoding is UTF-8, filenames stored in
AS> a different locale can comprise illegal UTF-8 sequences and are
AS> therefore not representable as FilePath which is a Unicode string. Even
AS> if the resulting Unicode sting is not 'error ".."', it is impossible to
AS> call 'delete' on that file name, since fromUTF8 . toUTF8 cannot be the
AS> identity function if the UTF8 byte sequence is illegal.

AS> The solution: FilePath must be an abstract data type that is a sequence
AS> of bytes. Programmers should only convert these to Unicode for
AS> displaying them and otherwise treat them as opaque entities. In case of
AS> invalid UTF-8 strings, the corresponding String will have an "invalid
AS> unicode code character" substituted.

but even my library can't really solve all problems. win95-based
Oses don't support unicode APIs, afaik

Best regards,
 Bulat                            mailto:bulatz at HotPOP.com

More information about the Libraries mailing list