Issue 2571 revisit encoding when reading/writing text files

Title revisit encoding when reading/writing text files
Priority Status unknown
Milestone Resolved in
Superseder Nosy List bf
Assigned To

Created on 2018-03-04.18:35:13 by bf, last changed 2018-03-04.18:35:13 by bf.

msg19936 (view) Author: bf Date: 2018-03-04.18:35:12
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.
Date User Action Args
2018-03-04 18:35:13bfcreate