-->
Page 1 of 1

How to print correct accent text in other languages ?

PostPosted: Sun Sep 18, 2016 3:17 pm
by aphawk
I'm using OpenWeather API, and the result text are returned in Portuguese.

One text is this : "céu claro" that is equivalent to "Clear Sky" in English. I get this result and put it in variable v_desc .

I'm using Wprint htmlvar(v_desc) to send this to screen, using Returngui command.

But the text that appears in my browser is this :


céu claro


This happens with many others accent characters, that are very common in Portuguese and others languages.

Update : the same problem occurs when sent to an Oled or an TFT display !

This can be fixed, or resolved with other way ?

Thanks.

Re: How to print correct accent text in other languages ?

PostPosted: Tue Sep 20, 2016 6:41 pm
by Mmiscool
I think this is going to require an arduino experter. I am not too familair with how arduino internaly handels character sets for stings or how other languages are handedled.

Re: How to print correct accent text in other languages ?

PostPosted: Tue Sep 20, 2016 8:37 pm
by aphawk
Mmiscool,

I don't program in Arduino, only uses Bascom and AVR Asm... but I found this :

The problem is that GCC compiler uses UTF-8 encoding.... the Arduino IDE / gcc - compiler replaces some original ASCII code by sequences of two or even three bytes ! And this is exactly what I have in display !

Maybe using the charset UTF8 in the Web Page can resolve this for Web output ?

See it here, and there is one example decode routine :

http://playground.arduino.cc/Main/Utf8ascii


I think that correction can be made for Oled/TFT , because these special bytes are determined, and one small routine can track these special byte sequences, and replace by the right character in the Font Table for the Oled or the TFT.

This will help a lot for peoples like me that want to show messages in the Oled or TFT display, and if this is possible with Web output too, will be the heaven !

Maybe you can correct this for the Oled/TFT only ?

Or maybe this TFT-8 use can be disabled in one compiler directive ?

Thanks a lot for your help !