ISO8859_1 handling problems

"Hellas Energy" <[email protected]>
Newsgroups gmane.comp.hardware.microcontrollers.tini
Message-ID <[email protected]>
Hi,
In the following example,running on Tini,

String message=the greek capital alphabet
char[] chars=new char[message.length()];
message.getChars(0,message.length(),chars,0);
int[] code=new int[chars.length];
for(int i=0;i<code.length;i++){
code[i]=(int)chars[i];
}

i get the following results

code[0]=145 or (0x91) 	(this is the capital greek ALPHA which in ISO8859_1
has 0x0391 code)
code[1]=146 or (0x92)	(this is the capital greek BETA which in ISO8859_1 has
0x0392 code)
.
.
.

Looks like only the low order byte is taken into account.

On the other side if i use
System.out.println((int)'the greek capital alpha character'), i get the
right result,913 or 0x391

Am i missing something?

Best Regards
Kostas Bouzianas


_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/[email protected]
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.