[Haskell-cafe] Re: Unicode workaround for getDirectoryContents under Windows?

Yitzchak Gale gale at sefer.org
Tue Jun 16 08:46:12 EDT 2009

Simon Marlow wrote:
>>> Care to submit a patch to put this in System.Directory, or better still
>>> put the relevant functionality in System.Win32 and use it in
>>> System.Directory?

Bulat Ziganshin wrote:
>> now getDirectoryContents return ACP (ansi code page) names so openFile
>> works for files 1) and 2).
>> With such change getDirectoryContents will return correct unicode
>> names, so openFile will work only with names in first group.
>> The right way is to fix ALL string-related calls in System.IO,
>> System.Posix.Internals, System.Environment.

> You're right in that we really ought to fix everything.  However, I'm happy
> to just fix some of these things, even if it introduces some inconsistencies
> in the meantime.  We already have much of System.Directory working with
> Unicode FilePaths, so there are already inconsistencies here.

+1 for integrating Unicode file paths. Thanks, Bulat!

I think the most important use cases that should not break are:

o open/read/write a FilePath from getArgs
o open/read/write a FilePath from getDirectoryContents

There's not much we can do about non-Latin-1 ACP file paths
hard coded in Strings. I hope there aren't too many
of those in the wild.


More information about the Haskell-Cafe mailing list