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

Michael Snoyman michael at snoyman.com
Wed Mar 30 08:52:54 CEST 2011


Hi all,

I think this is a well-known issue: it seems that there is no
character decoding performed on the values returned from the functions
in System.Directory (getDirectoryContents specifically). I could
manually do something like (utf8Decode . S8.pack), but that presumes
that the character encoding on the system in question is UTF8. So two
questions:

* Is there a package out there that handles all the gory details for
me automatically, and simply returns a properly decoded String (or
Text)?
* If not, is there a standard way to determine the character encoding
used by the filesystem, short of hard-coding in character encodings
used by the major ones?

For those curious: this is in regards to a bug in wai-app-static[1].

Thanks,
Michael

[1] http://hackage.haskell.org/package/wai-app-static



More information about the Haskell-Cafe mailing list