[Haskell-cafe] gbp sign showing as unknown character by GHC
Judah Jacobson
judah.jacobson at gmail.com
Wed Aug 19 18:53:03 EDT 2009
On Wed, Aug 19, 2009 at 10:31 AM, Iain Barnett<iainspeed at gmail.com> wrote:
> Quick question: I've tested this in a couple of different terminals (roxterm
> and xterm), so I'm fairly sure it's GHC that's the problem. Have I missed a
> setting?
> GHCi, version 6.10.4
> Prelude> putStrLn "£"
> �
> Hugs98 200609-3
> Hugs> putStrLn "£"
> £
>
ghc-6.10.4 and earlier don't automatically encode/decode Unicode
characters. So on terminals which don't use the latin-1 encoding, you
need to do the conversion explicitly with a separate package such as
utf8-string, iconv or text-icu. For example, on OS X:
$ echo $LANG
en_US.UTF-8
$ ghci
Prelude> putStrLn "£"
?
Prelude> System.IO.UTF8.putStrLn "£"
£
The conversion is done automatically by hugs, which is why the outputs
differ. This feature will also be supported in ghc-6.12.
-Judah
More information about the Haskell-Cafe
mailing list