[Haskell-cafe] Same compiled program behaving differently when called from ghci and shell

Bruno Damour llama at ruomad.net
Sun Nov 21 13:06:39 EST 2010


Le 21/11/10 17:21, Manlio Perillo a écrit :
> Il 21/11/2010 06:49, Bruno Damour ha scritto:
>> Hello,
>> I have a very strange (for me) problem that I manage to reduce to this :
>> I have a small program that reads a file with 1 only character (è = e8)
>> The program is ftest2.hs :
>>
>> [...]
> The only difference I can see is the codepage used.
>
> The Windows console use codepage 850:
> http://stackoverflow.com/questions/1259084/what-encoding-code-page-is-cmd-exe-using
>
> Instead the default codepage of Windows for western languages is 1252.
>
>
> Now, "fate" is that (Python console):
>>>> '\xe8'.decode('cp1252').encode('cp850')
> '\x8a'
>>>> '\xde'.decode('cp1252').encode('cp850')
> '\xe8'
>
>
> You can now see the possible cause of the problem.
>
>
> Try to change the codepage of the console.
> See also:
> http://www.postgresql.org/docs/9.0/interactive/app-psql.html#AEN75686
>
>> [...]
>
>
> Regards   Manlio
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
yes I kind of began to figure that IO might use an environment setting. 
That souns a bit weird to me (newbe) at it should impact the result of a 
program depending on where it is launched... its the same binary anyway 
? or ?



More information about the Haskell-Cafe mailing list