[Haskell-cafe] Encoding-aware System.Directory functions

Ketil Malde ketil at malde.org
Thu Mar 31 10:13:47 CEST 2011

John Millikin <jmillikin at gmail.com> writes:

> OSX's chief weirdness is that its GUI programs swap ':' and '/' when 
> displaying filenames. 

A remnant from the bad old days of MacOS <10, where : was the path
separator, and / was a perfectly good character to use in filenames.

> -- | Try to decode a FilePath to Text, using the current locale encoding. If
> -- the filepath is invalid in the current locale, it is decoded as ASCII and
> -- any non-ASCII bytes are replaced with a placeholder.

Why not map them to individual placeholders, i.e. in a private Unicode area?

This way, the conversion could be invertible, and possibly even
sensibly displayable given a guesstimated alternative locale (e.g. as
Latin 1 if the locale is a West European one).

If I haven't seen further, it is by standing in the footprints of giants

More information about the Haskell-Cafe mailing list