Sending special language characters to the Nextion display

Nextion display, how can I send accented characters?
The code is in the firmware of an 8266.
The current code is displayed on the screen as follows:
The code:

- platform: nextion
id: disp
lambda: |-
auto time = id(ido).now();
it.set_component_text_printf("t0", "%d:%.2d", time.hour,time.minute);
it.set_component_text_printf("t4", "%d:%.2d:%.2d", time.year,time.month,time.day_of_month);
it.set_component_text_printf("t1", "Hőm: %.1f °C", id(terasz_hom).state);
it.set_component_text_printf("t2", "Pára: %.1f %%", id(terasz_para).state);
it.set_component_text_printf("t3", "Elem: %.0f %%", id(terasz_elem).state);

I tried this too, but it didn’t work:
the ttf file is copied to the fonts folder

  - file: 'fonts/Roboto-ThinItalic.ttf'
    id: font2
    glyphs: ['&', '@', '!', ',', '.', '"', '%', '(', ')', '+', '-', '_', ':', '°', '0',
    '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'Á', 'B', 'C', 'D', 'E',
    'F', 'G', 'H', 'I', 'Í', 'J', 'K', 'L', 'M', 'N', 'O', 'Ó', 'Ö', 'Ő', 'P', 'Q', 'R', 'S', 'É',
    'T', 'U', 'Ú', 'Ü', 'Ű', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
    'g', 'h', 'i', 'í', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
    'u', 'v', 'w', 'x', 'y', 'z','á', 'é', 'ö', 'ő', 'ü', 'ű', 'ó', '/']



I have the same problem and I can’t solve it either. I tried using a sensor template that should change the special characters to hex (in HA not in ESPhome):

   - platform: template
         friendly_name: 'rooms_with_open_windows_v_nextion_02'
         value_template: >
           {{ states('sensor.rooms_with_open_windows') | replace("Ä", "\xC4",1) | replace("Ö", "\xD6") | replace("Ü", "\xDC", 1) | replace("ä", "\xE1",1) | replace("ö", "\xEF") | replace("ü", "\xF5", 1) | replace("°", "\xDF") | replace("ß", "\xE2", 1) | replace("µ", "\xE4", 1) | replace("€", "Euro") | replace("à", "\xE0", 1) | replace("á", "\xE1", 1)}}

In the template editor the change works fine:

And this is my settings in ESPHome:

  - platform: homeassistant
    id: fenster
    entity_id: sensor.rooms_with_open_windows_v_nextion
        - lambda: 'id(disp1).set_component_text_printf("t0", id(fenster).state.c_str());'

But not on the Nextion display:

As I recall it, each don’t in nextion display has a set of characters you can use.
If the character you try to display is not in the list then it won’t work.

Look at the font characters in nextion editor

Thanks for the reply @Hellis81. On the Nextion side everything seems to be working.
When I use this code in ESPhome it works as I expect:

  - platform: homeassistant
    id: fenster
    entity_id: sensor.rooms_with_open_windows_v_nextion
        - lambda: 'id(disp1).set_component_text_printf("t0", "B""\xFC""ro"); '

So it basically works with the HEX code. But the error seems to be with the sensor templating. HA converts the HEX code “\xFC” back into a string (into a “ü”).

Same problem was here. I wanted to display localized weekday from a sensor:

Nextion project configured as ISO8859-2, used font also ISO8859-2.

Problematical character:

Used in ESPHome with code \x161 did not help:

The code compiled with a warning and the character hasn’t been displayed correctly.

Using unicode helped with compilation, but the character hasn’t been displayed correctly either:

What helped? Using UTF-8 font in the Nextion project. UTF-8 font with all characters is huge, so I’ve listed all characters I will be using (ASCII + some special characters). In ESPHome, no character conversion or codes are needed:

And the special character is displayed correctly. Finally :wink: