[Haskell-cafe] gbp sign showing as unknown character by GHC
ketil at malde.org
Thu Aug 20 05:07:46 EDT 2009
Stuart Cook <scook0 at gmail.com> writes:
> GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help
> Loading package base ... linking ... done.
> Prelude> map Data.Char.ord "饁"
>  <== 0x9941
> Prelude> putStrLn "饁"
> A <== 0x41
> It seems that GHCi is clever enough to decode UTF-8 input, which only
> serves to confuse System.IO even more.
GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help
Loading package base ... linking ... done.
Prelude> map Data.Char.ord "饁"
Prelude> map Data.Char.ord "£"
% ghci -e 'map Data.Char.ord "饁"'
lexical error in string/character literal at character '\129'
% ghci -e 'map Data.Char.ord "£"'
So GHCi used interactively translates input from the terminal's UTF-8,
but outputs truncates output to eight bits. Executing a string with
-e, it appears to read byte for byte (which I think was the original
behavior at some point).
If I haven't seen further, it is by standing in the footprints of giants
More information about the Haskell-Cafe