Description
From https://www.snoyman.com/blog/2020/10/haskell-bad-parts-1:
Locale sensitive file encoding and decoding laughs in our face. When you use Data.Text.IO.readFile, it plays a mind reading game of trying to deduce from clues you don’t care about which character encoding to use. These days, on the vast majority of systems used by native English speakers, this turns out to be UTF-8. So using readFile and writeFile typically “just works.” Using functions from Data.Text.IO looks safe, and can easily get hidden in a large PR or a library dependency.
IOW readFile decodes bytes using an encoding selected based on locale inference (from env vars like LANG
and such).
Our use of readFile
is just for reading a key file which I guess should always be ASCII but it looks like this may still break if the locale env vars are unset.