[gambit-list] integer->char for an integer from interval [128, 255]

Dmitry Lizorkin lizorkin at ispras.ru
Fri Jun 24 08:59:40 EDT 2005


Hello!

Marc, thank you for the explanation and for the solution of my problem. It
works fine now. Thank you a lot!

Dmitry

----- Original Message -----
From: "Marc Feeley" <feeley at iro.umontreal.ca>
To: "Dmitry Lizorkin" <lizorkin at ispras.ru>
Cc: <Gambit-list at iro.umontreal.ca>
Sent: Wednesday, June 08, 2005 6:19 PM
Subject: Re: [gambit-list] integer->char for an integer from interval [128,
255]


>
> On 31-May-05, at 9:14 AM, Dmitry Lizorkin wrote:
>
> > Hello!
> >
> > I am working with Gambit interpreter, and the following result is
> > unexpected
> > for me:
> >
> > (string (integer->char 127))
> > ==> "\177"
> >
> > (string (integer->char 128))
> > ==> ""
> >
> > (string (integer->char 256))
> > ==> "\x100"
> >
> > I don't understand why the empty string is returned for an integer
> > from the
> > interval [128, 255].
> >
> > Could you please exlpain this to me? What should I do to obtain the
> > character that corresponds to an integer from the interval [128, 255]?
>
> The string that is returned is of length 1 (it is not the empty
> string).  It is just that the character (integer->char 128) has no
> graphic representation on your terminal.  The Gambit runtime will use
> escapes for some characters (below 32, or = 127, or greater or equal
> to 256).  In the next release I will bring the upper limit down to
> 128, so that the output of write is always ASCII characters that have
> a graphic representation.  In the meantime you can do this:
>
>  > (##vector-set! ##main-readtable 9 127)
> #<readtable #25>
>  > "\x80"
> "\200"
>
> Marc
>





More information about the Gambit-list mailing list