
Ben Franksen wrote:
GHC/base does not by default do what I claimed it does, as I learned later and you confirm now. It does that only if the program expressly demands it by specifying a so-called "char8" encoding, by initializing the global variable localeEncoding before the base library does it for you. With this you can override the user's locale as seen by GHC/base. I was working on Darcs and this is what Darcs does. But I was not aware of this hack and used to local reasoning in Haskell (doesn't Haskell claim to be a purely functional language?).
I should perhaps add that I was also misled by the documentation in the base library, where at one place it says that setLocaleEncoding does not influence the value you get with getFileSystemEncoding (which is used to decode command line arguments and environment variables). This is true once the base library has initialized the variable, but since the initialization is lazy, as with all globals in Haskell, setLocaleEncoding does have an effect if you do it early enough. Perhaps this might be a worthwhile addition to the docs. Cheers Ben -- "Make it so they have to reboot after every typo." -- Scott Adams