How to format char type umlaut vowels in mcuxpresso

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to format char type umlaut vowels in mcuxpresso

2,138 Views
Kratz
Contributor IV

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?

0 Kudos
7 Replies

2,067 Views
Kratz
Contributor IV

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.

 

0 Kudos

2,075 Views
ErichStyger
Senior Contributor V

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

0 Kudos

2,070 Views
ErichStyger
Senior Contributor V

Just to add to this and give an example:

Source file is set to UTF-8: (is the default anyway):

ErichS_1-1609951222348.png

That way I can write extended characters to the file.

Writing text to the UART (through the logger interface, but that does not matter):

ErichS_0-1609951185627.png

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:

ErichS_3-1609951351698.png

 

The first line is with ISO-8859-1:

ErichS_4-1609951398154.png

 

The second with UTF-8:

ErichS_2-1609951336908.png

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

0 Kudos

2,050 Views
Kratz
Contributor IV

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?

0 Kudos

2,124 Views
converse
Senior Contributor V

 

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

 

0 Kudos

2,083 Views
Kratz
Contributor IV

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?

text editor settings.jpg

 

0 Kudos

2,077 Views
converse
Senior Contributor V

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"

0 Kudos