GHC truncating Unicode character output
问题 I can't get GHCi or GHC to print unicode codepoint 221A (sqrt symbol: √). I don't think it's my shell, because I can get ruby to do it: irb> puts "\u221A" √ GHC/GHCi is another issue: ghci> putStrLn "\8730" ghci> withFile "temp.out" WriteMode $ flip hPutStrLn "\8730" ghci> readFile "temp.out" "\SUB\n" So what am I doing wrong? (GHC v6.l0.3) 回答1: GHC's behavior with unicode changed in GHC 6.12.1 to "do the right thing" with Unicode strings. Prior versions truncate to 8 bit characters on IO