[Haskell-cafe] Encoding problem (?)

Bruno Damour llama at ruomad.net
Mon Nov 15 10:16:49 EST 2010


Hello,
I have this strange problem, with the same program (simple) behaving differently when run from console and from WinGHCi.
Platform is Windows XP. Haskell Platform 2.0.0.

The program :
   import IO
   import Data.Maybe
   tfind s = lookup (head s) $ zip "\232\222" "12"
   main	= do
	h <- readFile "g:\\CODE\\rlib\\test.txt"
	putStrLn h
	print $ tfind h

The file test.txt only contains a "è" (should be \232). Encoding is ANSI.

I compile the pgm from WinGHCi :

Prelude> :! ghc --make "ftest2.hs"

and run it from WinGHCi :

Prelude> :! ftest2.exe
è
Just '1'


Now if I use the _same_ compiled program from cmd line :

g:\CODE\rlib>ftest2.exe
è
Just '2'

Is there any plausible explanation ?

Bruno


More information about the Haskell-Cafe mailing list