My project display several languages on a simple character display, 8 bits. The char code table is attached for the character LCD. The IDE has been changed to MCUXpresso. In Code Warrior to display a German "u" with the dots over it, umlaut I believe, a ',$F5," was added within the string (' ENTER dr',$F5,'cken '). In IAR the "u" with the umlaut just worked in the message line {" ENTER drücken "}. In MCUXpresso how should the a, o, and u be formatted to get the umlaut?
What is being written to is a 16 x4 character LCD. the original post has the codes to display characters.
A subroutine "void write_data (uint8_t data)" controls the RS and E enable lines, sends 8 bit data to the LCD with the proper timing loops. The printf() statement is not used. Once the letter is formatted correctly, the LCD should take "ALT + 132" and produce the correct letter.
How have you defined your string? is it wchar_t? The string worked in Code Warrior and in KDS. Here is how the array is defined:
const uint8_t spec_security_menu [spec_menu_13][LANGUAGE][CHOICE_4][CHAR_16] =
Which library are you using? It should be newlib (or newlib-nano)
Actually no library was being used. I did try the stdio.h because of your suggestion since it is being used for printing to the debugger console.
Which locale are you using? I do not know what that means.
Suggest you search for "UTF8 handling in C" I will do that.
Hi @Kratz ,
there are several levels for 'wide' (or non-7bit ASCII):
- using it in the source files: here you have to configure the encoding for example to UTF-8
- using it in your code: here it depends if you are using wchar_t or any of the wchar functions (e.g. wprintf()). On top of that it depends where you want to output the characters (terminal (you need to have proper encoding there), graphic display (here again you have the need for support too), ...
It would be useful to know your exact use case.
Erich
Just to add to this and give an example:
Source file is set to UTF-8: (is the default anyway):
That way I can write extended characters to the file.
Writing text to the UART (through the logger interface, but that does not matter):
The compiler can handle this because of UTF-8.
The bytes will be sent over the UART. Now to see it you have to configure your terminal.
Below I show it with PuTTY:
The first line is with ISO-8859-1:
The second with UTF-8:
So it is important that you have both sides (code and terminal) using the same.
I hope this helps,
Erich
I hope this helps,
Erich
I see the problem. The character LCD's letter codes overlap with UTF-8 chart for the left columns but not for the right columns where the "u" with the umlaut are. I tried to use "ALT + 245" but "⌡" appeared instead of the "o" with a tilda over it as the UTF-8 chart shows. The "⌡" does not print the right char on the LCD either. How can I code in the 245 (0xF5) or put the o with a tilda over it in the string?
First, make sure you editor is set to UTF-8 text encoding (Window->Preferences, General->Workspace encoding options are towards the bottom of the screen)
You can then enter characters directly in your string using the following using ALT and the keypad to enter the character code:
https://www.vistawide.com/languages/typing_foreign_language_characters.htm#german
My text editor is set to UTF-8 and has been as the default selection. "alt + 132" successfully produced an "a" with the umlaut dots producing the correct letter in the array. However the umlaut letter is not compiling or displaying correctly yet. The letter turns into a Japanese character. I can tell you know understand what I am trying to do. What else can I try to make it format correctly?
How have you defined your string? is it wchar_t?
Which library are you using? It should be newlib (or newlib-nano)
Which locale are you using?
Suggest you search for "UTF8 handling in C"