This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: byte array to string conversion


Tom Tromey wrote:

"Lars" == Lars Andersen <lars@rimfaxe.com> writes:



Lars> Substitute "iso-8859-1" with "UTF-8" and only Sun jdk works (at least Lars> for me)

Are you sure it really works with the JDK?
The byte buffer you're passing to the String constructor doesn't
contain a valid UTF-8 sequence.

Tom



Yep.


And in the "UTF-8" case I noticed the following differences between JDK and GCJ :

JDK : allBytesString.length() = 256
GCJ : allBytesString.length() = 128

And the characters are offset by 128, so allBytesString.charAt(40) in GCJ would match allBytesString.charAt(168) in JDK

/Lars Andersen


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]