Can't use writeFile to write unicode characters.
I tried to the "locale" environmental variables to "en_US.utf8", but still I cannot write unicode characters.
source:
main = do
hSetEncoding stdout utf8
putStrLn "αρχίδια"
writeFile "hello.txt" "σκατούλες"
output:
αρχίδια
commitBuffer: invalid argument (Illegal byte sequence)
without manually hSetEncoding stdin, putStrLn also fails with the same error message.
From what I was told on #haskell, on linux ghc uses setlocale to figure out what encoding to use, but this is not present in OpenBSD.
Simply making those functions read $LANG (I think) would solve this for OpenBSD, but I might be wrong.
Trac metadata
Trac field | Value |
---|---|
Version | 7.0.4 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries (other) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |