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

Simon Marlow marlowsd at gmail.com
Tue Jun 16 08:34:29 EDT 2009


On 16/06/2009 12:42, Bulat Ziganshin wrote:
> Hello Simon,
>
> Tuesday, June 16, 2009, 3:30:31 PM, you 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?
>
> Simon, it will somewhat broke openFile. let's see. there are 3 types
> of filenames -
>
> 1) english (latin-1) only
> 2) including local (ansi code page) chars
> 3) including any other unicode chars
>
> 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.

Thanks for reminding me that openFile is also broken.  It's easily 
fixed, so I'll look into that.

Cheers,
	Simon


More information about the Haskell-Cafe mailing list