I am trying to use GHC on wine to build one of my Haskell applications for windows. So far, this works well, but I am stuck running my test suite, which is intended to be run in an UTF8-locale (LANG=C.utf8
for example.)
Unfortunately, under wine, the Haskell runtime always believes I want to use a non-unicode codepage:
$ wine ghc -e 'GHC.IO.Encoding.CodePage.localeEncoding'
CP850
$ LANG=C.utf8 wine ghc -e 'GHC.IO.Encoding.CodePage.localeEncoding'
CP437
$ LC_ALL=C.utf8 wine ghc -e 'GHC.IO.Encoding.CodePage.localeEncoding'
CP437
Besides changing the actual code to set the encoding of all handles: How would I make the Haskell program use UTF-8 (i.e. codepage 65001) here?
I don't have a Wine/Haskell setup here, so take this with many grains of salt. It looks GHC.IO.Encoding has what might be the right pieces for this:
setLocaleEncoding :: TextEncoding -> IO ()
utf8 :: TextEncoding
You could try making your test programs setLocaleEncoding utf8
before they get going. This isn't quite what you wanted, but if it works it seems easier than setting it separately for each handle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With