[Haskell-cafe] gbp sign showing as unknown character by GHC
iainspeed at gmail.com
Thu Aug 20 07:39:11 EDT 2009
2009/8/20 Ketil Malde <ketil at malde.org>
> 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.
> I get:
> 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 "£"
> but also:
> % ghci -e 'map Data.Char.ord "饁"'
> lexical error in string/character literal at character '\129'
> but again:
> % 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).
I get the same behaviour here.
If you want to try Latin 1 (ISO-8859-1) then you can use a utility called
Luit (maybe only Linux?)
luit -encoding ISO-8859-1 ghci
£ becomes Â£, but gives the same byte output as above.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe