On Wed, 14 Mar 2012 14:51:59 +0100
Volker Wysk <p...@volker-wysk.de> wrote:

> 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

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to