[Haskell-cafe] Re: Unicode workaround for getDirectoryContents
under Windows?
Bulat Ziganshin
bulat.ziganshin at gmail.com
Tue Jun 16 08:54:50 EDT 2009
Hello Simon,
Tuesday, June 16, 2009, 4:34:29 PM, you wrote:
> Thanks for reminding me that openFile is also broken. It's easily
> fixed, so I'll look into that.
i fear that it will leave GHC libs in inconsistent state that can
drive users mad. now at least there are some rules of brokeness. when
some functions will be unicode-aware and some ansi codepaged, and this
may chnage in every version, this "unicode" support will become
completely useless. it will be like floating Base situation when it's
impossible to write programs against Base since it's each time different
also, i think that the best way to fix windows compatibility is to
provide smth like this:
#if WINDOWS
type CWFilePath = LPCTSTR -- filename in C land
type CWFileOffset = Int64 -- filesize or filepos in C land
withCWFilePath = withTString -- FilePath->CWFilePath conversion
peekCWFilePath = peekTString -- CWFilePath->FilePath conversion
#else
type CWFilePath = CString
type CWFileOffset = COff
withCWFilePath = withCString
peekCWFilePath = peekCString
#endif
and then systematically rewrite all string-related OS API calls using
these definitions
how much meaning will be to have openFile and getDirContents
unicode-aware, if deleteFile and even getFileStat aren't unicode-aware?
i've attached my own internal module that makes this job for my own
program - just for reference
--
Best regards,
Bulat mailto:Bulat.Ziganshin at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Win32Files.hs
Type: application/octet-stream
Size: 10631 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090616/a7b41302/Win32Files.obj
More information about the Haskell-Cafe
mailing list