[darcs-devel] [issue2571] revisit encoding when reading/writing text files

Ben Franksen bugs at darcs.net
Sun Mar 4 18:35:13 UTC 2018


New submission from Ben Franksen <ben.franksen at online.de>:

Darcs.Util.Lock exports readTextFile, writeTextFile, and appendTextFile,
of which only writeTextFile explicitly sets the encoding. Either all the
functions should do this or none.

The motivation for using the fileSystemEncoding for writeTextFile is
that the content to write may not be valid unicode i.e. coming from some
external raw ByteString that may not be properly encoded according to
the user's locale. Perhaps it is enough that we override this once at
the start of the program (setDarcsEncodings). If this is the case we can
remove the line

  getFileSystemEncoding >>= hSetEncoding h

in writeTextFile.

----------
messages: 19936
nosy: bf
status: unknown
title: revisit encoding when reading/writing text files

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue2571>
__________________________________


More information about the darcs-devel mailing list