
Hi Arie,
If you don't mind binding code.
You can try to use GIO APIs from my repository:
http://patch-tag.com/r/AndyStewart/gio-branch/home
GIO APIs handle unicode filename every well, and cross-platform.
Cheers,
-- Andy
Arie Peterson
After upgrading to haskell-platform-2010.1.0.0, with the improved unicode support for IO in ghc-6.12, I hoped to be able to deal with filenames containing non-ascii characters. This still seems problematic, though:
$ ls m×n♯α $ ghci GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help Prelude> :m +System.Directory Prelude System.Directory> getDirectoryContents "." >>= mapM_ putStrLn .. mÃnâ¯Î± .
I hope this passes through the various email systems unharmed; on my terminal, the output of 'ls' contains shiny unicode characters, while 'ghci' garbles up the filename. (My locale is en_GB.utf8.)
Similar problems arise with functions such as 'copyFile', which refuses to handle filenames with non-ascii characters (unless wrapping it with encoding functions).
Is this a known problem? I searched ghc's trac, but there are no relevant bugs for the component 'libraries/directory'.
I have parts of a unicode-aware layer on top of System.Directory laying around somewhere. I was rather hoping to ditch it, but I can polish it and put it on hackage, if people are interested.
Kind regards,
Arie