Monday 12 August 2013

English and Grek UTF characters difference

English and Grek UTF characters difference

I have defined the same char array with english and greek characters.
char myText[]="ÇÔÉÁ ÇÔÉÁÁÁ ËÏÕËÏÕÄÉÁÓÌÅÍÇ!!!1234567890";
// char myText[]="HTIA HTIAAA LOULOUDIASMENH!!!1234567890";
When i print the length with strlen(myText);of the char array the first
one that has Greek UTF8 characters has length of 63 characters but the
second has 39. Why does this happened? Who can i fix this or the proper
question is how to syntax Greek Unicode Greek character so the program
understand them correctly?
I send the char array to a led matrix and i message does not display on
screen as it does when the chars are english.It seems that greek
characters or non-ASCII characters are bigger than one byte.
I have a switch function that check the characters and returns an
appropriate byte array for each letter.I have set the default case of the
switch to the character ! So instead of getting HTIA HTIA i get !H!T!I!A!.
So my switch understands the greek character as more than 1 byte and
returns first the default case witch is ! and then the correct character.
Also when i try to print the text i get error on the serial monitor(the
characters does not display correctly).

No comments:

Post a Comment