Umlaut in text area not showing

What do you want to achieve?

I have a lv_textarea and want to type in some special chars like umlauts.

What have you tried so far?

I’ve created a custom font with the web font converter, and the required symbols are included.
When typing an umlaut, I do see nothing.
When I hard code the very same umlaut, it is showing. So, the font seems to be fine and also the textarea somehow.

I’ve created an event handler for key stroke to log the input

void ControlPanelWindow::onConfigShortNameKeyPressed(lv_event_t *e)
{
    lv_obj_t *input = (lv_obj_t *)lv_event_get_target(e);

    uint32_t keyCode = lv_event_get_key(e);
    uint8_t actualKey = keyCode & 0xFF;
    
    // Log the keystroke in hex
    const char* utf8Info = "";
    if (actualKey == 0xC3) {
        utf8Info = " [UTF-8 start]";
    } else if (actualKey >= 0x80 && actualKey <= 0xBF) {
        utf8Info = " [UTF-8 cont]";
        if (actualKey == 0xA4) utf8Info = " [UTF-8: ä]";
        else if (actualKey == 0xBC) utf8Info = " [UTF-8: ü]";
        else if (actualKey == 0xB6) utf8Info = " [UTF-8: ö]";
        else if (actualKey == 0x84) utf8Info = " [UTF-8: Ä]";
        else if (actualKey == 0x9C) utf8Info = " [UTF-8: Ü]";
        else if (actualKey == 0x96) utf8Info = " [UTF-8: Ö]";
        else if (actualKey == 0x9F) utf8Info = " [UTF-8: ß]";
    }
    
    Log::debugf("🔤 ShortName key: 0x%02X%s", actualKey, utf8Info);
}

I get this log when typing äüö

[DEBUG] 🔤 ShortName key: 0xC3 [UTF-8 start]
[DEBUG] 🔤 ShortName key: 0xA4 [UTF-8: ä]
[DEBUG] 🔤 ShortName key: 0xC3 [UTF-8 start]
[DEBUG] 🔤 ShortName key: 0xBC [UTF-8: ü]
[DEBUG] 🔤 ShortName key: 0xC3 [UTF-8 start]
[DEBUG] 🔤 ShortName key: 0xB6 [UTF-8: ö]

But the text area looks still like this
image

Now, when I hardcode the umlauts, it is working

lv_textarea_set_text(_textArea, "üäö");

image

I am lost, as I do not understand the difference.

Environment

  • MCU/MPU/Board: SDL Simulator on macOS
  • LVGL version: 9.3.0

what is the output of lv_textarea_get_text() after you manually entered all your symbols ? interested to see in hex (0x…) codes.

Thanks for your reply.

This is the output, when I’ve programatically set the umlauts üäö

[DEBUG] 📝 newText: 0xC3 0xBC 0xC3 0xA4 0xC3 0xB6 ('üäö')

When I type üäö, I’ll get this log

[DEBUG] 📝 name newText: 0xC3 0xFF 0xBC 0xC3 0xFF 0xA4 0xC3 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF ('��������������������')

I’ve added LV_EVENT_READY and used this function for logging:

    lv_obj_t *input = (lv_obj_t *)lv_event_get_target(e);     
    const char *newText = lv_textarea_get_text(input);

    std::string hexLog = "📝 newText: ";
    for (int i = 0; newText[i] != '\0'; i++)
    {
        char hexByte[8];
        snprintf(hexByte, sizeof(hexByte), "0x%02X ", (unsigned char)newText[i]);
        hexLog += hexByte;
    }
    hexLog += "('";
    hexLog += newText;
    hexLog += "')";
    Log::debugf("%s", hexLog.c_str());

Seems that the input is corrupted. But I do not alter the typed chars. Not sure what happened

possible this depends on input method. as far as understand typical keyboard has only standard ASCII symbols on keys. utf-8 codes represented with 2 bytes should be coded as
110xxxyy 10yyzzzz
so code 0xC3 0xFF impossible in utf-8.

strange. It’s a physical keyboard.
It seems that 0xFF is added between lower and upper byte.

Do you think it’s a problem with the Hal driver?
Do you have an idea how I could fix it or work around?

I don’t really understand what’s going on. The key down event is working fine, right?
But the assembled text is then broken?!

maybe developers @embeddedt @kisvegabor can help

1 Like

Hey,

Sorry for the late reply. What kind of keyboard driver do you use? Is it SDL, Windows, or something else?

I’ve just noticed that SDL keyboard doesn’t handle non-ASCII very well.

Hallo @kisvegabor,

thanks for your reply :slight_smile:
Yes it is SDL keyboard. I am running the simulator on macOS.

I am creating these input devices during initialisation:

    lvMouse = lv_sdl_mouse_create();
    lvMouseWheel = lv_sdl_mousewheel_create();
    lvKeyboard = lv_sdl_keyboard_create();

Are you aware of any workaround?
The weird thing is, I had added some debug statements in the hal driver, and I think the SDL input is working fine.
That said, I do not know where exactly the problem occurs…

It’s not a show stopper for me, as the simulator is just for development and demo purpose, but still would be nice :slight_smile:

Thanks

Thank you for the context! It was an bug in the SDL driver. I opened a PR to fix it. Fortunately it was an easy fix.

1 Like

Thanks for the quick fix :slight_smile:
I am new to lvgl, so sorry for the stupid question.
Will it be part of the next release? I think 9.4 has been already release? But it was not yet published to platformio libraries, right? Can you say when the fix will be publicly available?

1 Like

Hi @caldicot

v9.4 will be released in 4 weeks - October 13th 2025

2 Likes

thank you all for your kind help :slight_smile: