Can't use writeFile to write unicode characters.
|Reported by:||tsou||Owned by:|
|Operating System:||OpenBSD||Architecture:||x86_64 (amd64)|
|Type of failure:||Runtime crash||Difficulty:||Unknown|
|Test Case:||Blocked By:|
I tried to the "locale" environmental variables to "en_US.utf8",
but still I cannot write unicode characters.
main = do hSetEncoding stdout utf8 putStrLn "αρχίδια" writeFile "hello.txt" "σκατούλες"
αρχίδια 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.
Change History (4)
comment:1 Changed 2 years ago by igloo
- Difficulty set to Unknown
- Milestone set to 7.6.1
- Status changed from new to infoneeded
comment:3 Changed 13 months ago by igloo
- Resolution set to worksforme
- Status changed from infoneeded to closed