
On Wed, 14 Mar 2012 14:51:59 +0100
Volker Wysk
Hi!
The following program demonstrates a (another) GHC bug. The command line isn't properly decoded to Unicode.
arg.hs------------------------------
import System main = do [a] <- getArgs putStrLn (show a)
--------------------------------------
When called like this:
./arg ä
The program will output this:
"\195\164"
First, no need for 'show'. It will try to serialize value in a portable way. 'putStrLn a' should do the right thing (but see below). Second, it was fixed in ghc-7.2+. System.Environment now returns properly encoded Strings instead of byte-encoded oddity it returned before. So you can use 'putStrLn a' there. Previous version would require you to recode the result to proper String -- Sergei