# [armedbear-devel] encoding bug in Stream.readPreservingWhitespace (classpath)

Erik Huelsmann ehuels at gmail.com
Sun Apr 25 09:36:36 UTC 2010

```Hi Eric,

On Sun, Apr 25, 2010 at 11:15 AM, Eric Marsden <eric.marsden at free.fr> wrote:
> Hi,
>
> Attempting to run ABCL with jamvm (which uses the classpath libraires),
> I get
>
> ,----
> | Armed Bear Common Lisp 0.20.0-dev
> | Java 1.5.0 GNU Classpath
> | JamVM
> | Low-level initialization completed in 0.371 seconds.
> | Exception in thread "interpreter" java.lang.IllegalStateException
> |    at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:163)

> `----
>
> I see in org.armedbear.lisp.Stream.read() a sequence
>
>                    if (n >= 0) {
>                        char c = (char) n; // ### BUG: Codepoint conversion
>                        if (!rt.isWhitespace(c))
>                    }
>
> which seems likely to be related to this problem. If I print
> #\space. Any suggestions on how to proceed?

Do you have any idea if the character you were trying to read is
outside of the BMP (a so-called Supplemental character; with a code
point > #xFFFF)? If that's the case, then you certainly did hit that
bug.

I had hoped the issue would be relatively infrequent when I added the
comment above. Maybe it is, but if you're hitting it, we seem to have
an active requirement to fix it...

Bye,

Erik.

```