Re: ISO8859_1 handling problems

"Kris Ardis" <Kristopher.Ardis-6tN4nzCoH/[email protected]>
Newsgroups gmane.comp.hardware.microcontrollers.tini
Message-ID <007f01c43114$da5902f0$764000b4@kardis>
Kostas
I could not reproduce the problem.  What firmware version are you using?  I
ran the following code on TINI 1.12...
  String message =
"\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039A";
  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];
  }

  System.out.print("Code: ");
  for (int i=0;i<code.length;i++)
  System.out.print(Integer.toHexString(code[i]) + " ");

And got this:
Code: 391 392 393 394 395 396 397 398 399 39a

Can you send me your class file and source file for which you are seeing a
failure?

Kris


----- Original Message -----
From: "Hellas Energy" <[email protected]>
To: "Tini" <tini-6tN4nzCoH/[email protected]>
Sent: Saturday, May 01, 2004 3:50 PM
Subject: [TINI]ISO8859_1 handling problems


> 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
>


_______________________________________________
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.