[Haskell-beginners] error writing FilePath to text file

Michael Snoyman michael at snoyman.com
Wed Jun 29 08:34:39 UTC 2016


On Wed, Jun 29, 2016 at 11:31 AM, Dennis Raddle <dennis.raddle at gmail.com>
wrote:

> Thanks. ​I don't know if I was clear that I'm writing the characters of
> the FilePath to a file. I could use something like:
>
> writeFilePaths :: FilePath -> [FilePath] -> IO ()
> writeFilePaths fileToWrite fps = ...
>
> The ByteStrings are for reading the files generated by the above and
> parsing with Text.Parsec.ByteString, for efficiency (these are many
> megabytes of text)
>
> D
>
>
>
A FilePath is just a type synonym for a String, so the same caveats will
apply to both. I'm guessing that you're dealing with some file paths that
have non-ASCII characters in them, and you have some locale environment
variables set that do not support UTF8. You can try rerunning your program
as-is with:

export LANG=en_US.UTF-8

in the shell (assuming you're on a POSIX system, Windows will behave
differently).

Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160629/fdf2556d/attachment.html>


More information about the Beginners mailing list