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.
|