
28 Nov
2010
28 Nov
'10
7:18 a.m.
Yitzchak Gale wrote:
You can check to see what encoding GHC has picked up from your environment by examining localeEncoding.
How do I do that? TextEncoding doesn't seem to be Showable.
You can force the encoding to UTF-8 by
hSetEncoding stdin utf8 hSetEncoding stdout utf8
All of the above in the context of import System.IO, of course.
Thank you. My program: main :: IO () main = do h <- openFile "unicode.txt" ReadMode hSetEncoding h utf8 hSetEncoding stdout utf8 text <- hGetContents h putStr text now works as it should. Cheers, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/