fix nonascii filenames handling in FileServe.hs #151

wants to merge 1 commit into

2 participants

cvb commented Jul 9, 2012

Actually just change Data.ByteString.Char8.unpack to Data.ByteString.UTF8.toString
in getSafePath.

Snap Framework member

Unfortunately this isn't a valid thing to do on all platforms, Windows in particular -- and on linux it's only appropriate when the underlying locale happens to be UTF-8 (i.e. not always). Windows uses UTF-16. It used to be that FilePath expected an ascii-encoded faux-String (i.e. all code points within [0..255] inclusive) but I suppose that must not be the case anymore.

The sane way to do this is to use system-filepath; would you mind revising your pull request accordingly? See e.g.

Edit: I should of course mention that UTF-8 on Linux is "canonical" these days and is what most programs assume, but ultimately as far as the kernel is concerned, file paths are bags of bytes.

cvb commented Jul 9, 2012

Sorry, using linux too much, well be back with better fix soon.

@cvb cvb closed this Jul 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment