[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problems with Character
From: |
Eric Blake |
Subject: |
Re: Problems with Character |
Date: |
Fri, 22 Mar 2002 16:34:04 -0700 |
I think the latest version of both files in Classpath should work.
Could it possibly be a VM error in adding two chars, and casting the
result back to a char? The data is encoded as signed offsets from the
current character, but stored as unsigned chars in the String constants;
so if your VM does the math wrong, you may be getting a weird index.
Another possibility - is your VM correctly handling reading in the UTF
string from the constant pool and converting it to char[]?
Can you do some more detective work? What do you get for
Character.readChar('a') and Character.readChar('A')? If I'm reading
CharData correctly, readChar('a') should be 0x1b02, so that you then
index UPPER[54] == '\uffe0' (in other words, 'a' + -30 => 'A').
readChar('A') should be 0xd01, so that you index LOWER[26] == ' ' (or
'A' + 32 => 'a').
Patrik Reali wrote:
>
> Hi!
>
> I'm experiencing some problems with java.lang.Character.
> The methods toUpperCase and toLowerCase return
> wrong results (most of the calls leave the values unchanged,
> a few return strange values). I went through the code,
> but there's not much.... they're just taking the result from
> some tables.
>
> I'm currently using the latest version of Character and CharData.
>
> Can anybody confirm (or dismiss) the problem?
>
> Thanks,
> Patrik
--
This signature intentionally left boring.
Eric Blake address@hidden
BYU student, free software programmer