Problems with Character

2002-03-22 Thread Patrik Reali

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

Patrik Reali
http://www.inf.ethz.ch/personal/reali
http://www.oberon.ethz.ch/jaos


___
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath



Re: Problems with Character

2002-03-22 Thread Eric Blake

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 [EMAIL PROTECTED]
  BYU student, free software programmer

___
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath