Unicode in GHCi

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Unicode in GHCi

Christos Chryssochoidis
Hello,

I'd like to type in GHCi some non-latin characters, but when I try it,
no characters are inserted at all. Latin characters though are typed
in fine, and in any other shell except GHCi I try non-Latin characters
get typed without problem.

I mean I'm not able to type in GHCi an expression like

'?' == '?'    (can't type in the ?)

Is this a known GHCi restriction on the character set it accepts, or
something is wrong with my setup of GHCi/terminal?

I'm using GHC 6.10.1 in Mac OS X Terminal.

Thank you very much,

Christos
Reply | Threaded
Open this post in threaded view
|

Re: Unicode in GHCi

Ahn, Ki Yung
Christos Chryssochoidis wrote:
> Hello,
>
> I'd like to type in GHCi some non-latin characters, but when I try it,
> no characters are inserted at all. Latin characters though are typed
> in fine, and in any other shell except GHCi I try non-Latin characters
> get typed without problem.

You should use the utf8-string library to print multibyte string
literals in GHC.

http://hackage.haskell.org/cgi-bin/hackage-scripts/package/utf8-string

Linux distributions usually have this packaged.
Otherwise, you can to install this using cabal.

I am not sure whether there is a direct support for wide characters in
Haskell.

> I mean I'm not able to type in GHCi an expression like
>
> '?' == '?'    (can't type in the ?)
>
> Is this a known GHCi restriction on the character set it accepts, or
> something is wrong with my setup of GHCi/terminal?
>
> I'm using GHC 6.10.1 in Mac OS X Terminal.

Reply | Threaded
Open this post in threaded view
|

Re: Unicode in GHCi

Christos Chryssochoidis
Thank you for your response!
Indeed utf8-string works fine for printing and reading utf8 strings!
I would also like to use multibyte characters in GHCi, but as the guys
at #Haskell told me yesterday, GHCi 6.10.1 switched from using
readline for line edting to the editline lib, and the latter can't
handle unicode characters, at least for now. But in GHCi 6.8 and the
older versions there shouldn't be any problem with unicode characters
in GHCi.

Thanks very much again!

Christos

On Wed, Nov 12, 2008 at 9:11 AM, Ahn, Ki Yung <[hidden email]> wrote:

> Christos Chryssochoidis wrote:
>>
>> Hello,
>>
>> I'd like to type in GHCi some non-latin characters, but when I try it,
>> no characters are inserted at all. Latin characters though are typed
>> in fine, and in any other shell except GHCi I try non-Latin characters
>> get typed without problem.
>
> You should use the utf8-string library to print multibyte string
> literals in GHC.
>
> http://hackage.haskell.org/cgi-bin/hackage-scripts/package/utf8-string
>
> Linux distributions usually have this packaged.
> Otherwise, you can to install this using cabal.
>
> I am not sure whether there is a direct support for wide characters in
> Haskell.
>
>> I mean I'm not able to type in GHCi an expression like
>>
>> '?' == '?'    (can't type in the ?)
>>
>> Is this a known GHCi restriction on the character set it accepts, or
>> something is wrong with my setup of GHCi/terminal?
>>
>> I'm using GHC 6.10.1 in Mac OS X Terminal.
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/beginners
>
Reply | Threaded
Open this post in threaded view
|

Re: Unicode in GHCi

Benjamin L. Russell
On Wed, 12 Nov 2008 13:35:12 +0200, "Christos Chryssochoidis"
<[hidden email]> wrote:

>Thank you for your response!
>Indeed utf8-string works fine for printing and reading utf8 strings!
>I would also like to use multibyte characters in GHCi, but as the guys
>at #Haskell told me yesterday, GHCi 6.10.1 switched from using
>readline for line edting to the editline lib, and the latter can't
>handle unicode characters, at least for now. But in GHCi 6.8 and the
>older versions there shouldn't be any problem with unicode characters
>in GHCi.

Incidentally, does anyone know the reason that GHCi 6.10.1 switched
from using readline to editline?

-- Benjamin L. Russell

Reply | Threaded
Open this post in threaded view
|

Re: Unicode in GHCi

Brent Yorgey-2
On Thu, Nov 13, 2008 at 12:20:32PM +0900, Benjamin L.Russell wrote:

> On Wed, 12 Nov 2008 13:35:12 +0200, "Christos Chryssochoidis"
> <[hidden email]> wrote:
>
> >Thank you for your response!
> >Indeed utf8-string works fine for printing and reading utf8 strings!
> >I would also like to use multibyte characters in GHCi, but as the guys
> >at #Haskell told me yesterday, GHCi 6.10.1 switched from using
> >readline for line edting to the editline lib, and the latter can't
> >handle unicode characters, at least for now. But in GHCi 6.8 and the
> >older versions there shouldn't be any problem with unicode characters
> >in GHCi.
>
> Incidentally, does anyone know the reason that GHCi 6.10.1 switched
> from using readline to editline?

I think it's because readline uses a GPL license, which technically
means that it can't be bundled with GHC since GHC isn't GPL.  Why this
was suddenly deemed important I'm not sure.

-Brent