Start a new topic

.setText() error input Korea language

Hi.

Attach a lot of screenshot images to help you understand.

I entered the korea language in the Attribute window of the Editor. It works well.

"안녕" means "Hi". hex code : 0xEC  0x95 0x88 0xEB 0x85 0x95

image



Open the Debug window and type "t0.txt ="하하"" and run it. This also works well.

image



But in the Arduino IDE, the result of t0.setText ("안녕") is very wrong.

image


image


It does not seem to be a problem with fonts, nor is it a problem with Arduino code.

What am I missing?


Can not anyone help me?

I am worried about purchasing a large amount of products.

as your first screeners show, the Nextion works well ...


 your Arduino just send out the wrong code ... but that's an Arduino issue ...

Arduino is usually UTF8/Unicode is not Korean KS_C_5601-1987 standard.

Your MCU code needs to handle such converting translations.

An MCU will only ever send bytes (0 to 255) in sequence.


Nextion can be used with 65000+ MCU types

 - in any of 130+ programming languages.


User MCU type and programming languages used in user project

remains within the user domain.

 - users are responsible for knowing their MCU, compiler and IDE used.


ENSURE that Device Character Encoding in the HMI is KS_C_5601-1987

ENSURE that the font used is generated with KS_C_5601-1987 with valid font

ENSURE text component uses the correct font 



Deal with your invalid Variable Parsing first

and keep in mind ...


    - this is a public forum ...

    - there won't be a claim to get an answer ...

    - there won't be a guarantee for an answer ...

    - answers are voluntary ...

Try this as a direct print from your Arduino to Nextion.... 

Serial.print("\x74\x30\x2E\x74\x78\x74\3D\x22\xEC\x95\x88\xEB\x85\x95\x22\xFF\xFF\xFF");

 If that works, then try similar in the library function... 

t0.setText("\xEC\x95\x88\xEB\x85\x95");

 I think you will figure what I did here :)

Thank you all. It has helped a lot.

I tried converting utf-8 Korean to KS_C_5601-1987 (CP949) and it was fixed.

HMI's font settings and Arduino were fine.

But I did not have enough understanding about the fact that Arduino was utf-8.

안녕 = 0xEC  0x95 0x88 0xEB 0x85 0x95(utf-8) = 0xBE 0xC8 0xB3 0xE7(CP949)

Thanks...

as already told, that's an Arduino issue ... that has nothing to do with Nextion ...

 


happy coding ...

Login or Signup to post a comment