edgetx icon indicating copy to clipboard operation
edgetx copied to clipboard

Swedish special characters not displayed in Xlite with LVGL

Open ulfhedlund opened this issue 3 years ago • 8 comments

Is there an existing issue for this problem?

  • [X] I have searched the existing issues

What part of EdgeTX is the focus of this bug?

Transmitter firmware

Current Behavior

After the update to LVGL in main branch, the "special" Swedish characters (åäöÅÄÖ) are displayed incorrectly as blanks on Xlite b/w radio. For TX16S it works as expected. Possibly the same for other languages special characters as well but I have only tested with a build of the Swedish firmware for Xlite and run it in the simulator, so not tested on the radio yet. I have attached a screenshot where "Ä" is missing in the top menu name MODELLINSTÄLLNING (model settings) and "ä" at the bottom Nedräkning (countdown).

Expected Behavior

All characters should be displayed correctly.

Steps To Reproduce

Compile main branch with "cmake -Wno-dev -DPCB=XLITE -DDEFAULT_MODE=2 -DGVARS=YES -DPPM_UNIT=US -DHELI=NO -DTRANSLATIONS=SE -DCMAKE_BUILD_TYPE=Release ../" and run in simulator.

Version

Other (Please specify below)

Transmitter

FrSky X-Lite / S / Pro

Anything else?

xlite_swechar_err

ulfhedlund avatar Jun 22 '22 19:06 ulfhedlund

You also need an updated se.h file since some strings are missing in the main branch. I've not yet made a PR for this but have attached an updated file (se_h.txt). se_h.txt

ulfhedlund avatar Jun 22 '22 20:06 ulfhedlund

You also need an updated se.h file since some strings are missing in the main branch. I've not yet made a PR for this but have attached an updated file (se_h.txt). se_h.txt

Would be cool if you could actually make a PR for the translation file ;-)

raphaelcoeffic avatar Jun 23 '22 09:06 raphaelcoeffic

Absolutely, that's the plan but I would like to work on the translations a bit more first :) I need a few more days.

ulfhedlund avatar Jun 23 '22 14:06 ulfhedlund

I have now created a PR (#2095), hope I did it right. I'm not at all comfortable with github.

ulfhedlund avatar Jun 25 '22 12:06 ulfhedlund

@rotorman has now merged PR #2095 to main :)

ulfhedlund avatar Jul 04 '22 18:07 ulfhedlund

@ulfhedlund so this issue here can be closed, right?

raphaelcoeffic avatar Jul 05 '22 17:07 raphaelcoeffic

@raphaelcoeffic I'm afraid not. When I just tested (in Companion simulator on Linux) newly built firmware from main the issue remains, i.e. special characters are still not displayed correctly. PR #2095 did not address this issue at all.

ulfhedlund avatar Jul 13 '22 15:07 ulfhedlund

Just tested with Danish translations on Xlite and it is the same there - special characters are not displayed correctly.

ulfhedlund avatar Jul 17 '22 10:07 ulfhedlund

Is there anything I can do to help with this? I suppose this issue is the same for all B/W radios (I have tested Xlite, X7 and X9D+) and for other languages than Swedish too (Danish for example). If anything that does not include coding needs to be done perhaps I can help. I am certainly willing to try.

ulfhedlund avatar Aug 30 '22 19:08 ulfhedlund

Maybe there is a bug in the utf-8 decoder

gagarinlg avatar Aug 30 '22 19:08 gagarinlg

It look like the character lookup tables for some language are missing in https://github.com/EdgeTX/edgetx/blob/main/radio/src/gui/common/stdlcd/utf8.cpp @ulfhedlund you can try to add those according to the other language chars, if you are able to compile the code to test it.

gagarinlg avatar Aug 30 '22 19:08 gagarinlg

Thank you, I have a local environment to build software so I'll add those and test it out.

ulfhedlund avatar Sep 01 '22 10:09 ulfhedlund

@gagarinlg - I did as you suggested and this issue now seems to be fixed! I have built firmware for X9D+, X7 and Xlite in Swedish and tested in simulator. All characters are now properly displayed.

I'll add a PR for this as soon as possible.

@HThuren: I also tried to add the Danish special characters and tested on X7 in simulator but it didn't work and the Swedish åäöÅÄÖ displayed instead. Maybe better than empty but not correct. Not sure why and I'll leave that to more capable hands. So I removed this from utf8.cpp: #elif defined(TRANSLATIONS_DA) static wchar_t _utf8_lut[] = { L'å', L'æ', L'ø', L'Å', L'Æ', L'Ø', };

ulfhedlund avatar Sep 01 '22 10:09 ulfhedlund

@ulfhedlund Thank you, I wasn't aware of this issue. So great you has it fixed :-)

HThuren avatar Sep 01 '22 20:09 HThuren

@HThuren: Right now Danish characters are still displayed as blanks (" "). I tried fixing this but ended up removing the above lines, since the Danish special characters weren't displayed properly, but rather the Swedish equivalents.

If you are happy with that, you can add the four lines above to utf8.cpp and make a PR. Svenska åäöÅÄÖ är kanske bättre än inget, till det går att ordna de korrekta danska bokstäverna?

ulfhedlund avatar Sep 01 '22 20:09 ulfhedlund

And the we look like idiots, because we can not add the correct Danish characters 🤔😜 We should fix the characters, can't be too hard.

gagarinlg avatar Sep 01 '22 20:09 gagarinlg

Arh, now I understand. this section must be ok, but I'm not sure how it works, ie the order of charaters. Normally we use æøå, ÆØÅ, but .. #elif defined(TRANSLATIONS_DA) static wchar_t _utf8_lut[] = { L'å', L'æ', L'ø', L'Å', L'Æ', L'Ø', };

HThuren avatar Sep 01 '22 20:09 HThuren

https://github.com/EdgeTX/edgetx/blob/main/tools/charset.py

There is no danish support in that file, so the danish special characters are not added.

gagarinlg avatar Sep 01 '22 21:09 gagarinlg

OK, leave it for now, I add (and want to test) after this PR #2259 are added to main.

HThuren avatar Sep 01 '22 21:09 HThuren

@HThuren Basically what this means is for Danish, you'd need both the

#elif defined(TRANSLATIONS_DA)
static wchar_t _utf8_lut[] = {
L'å', L'æ', L'ø', L'Å', L'Æ', L'Ø',
};

block you gave above in radio/src/gui/common/stdlcd/utf8.cpp

as well as a corresponding entry in https://github.com/EdgeTX/edgetx/blob/8aa2b55c503de70d5a7c0df1ca499597f3434613/tools/charset.py#L58-L72

and also at https://github.com/EdgeTX/edgetx/blob/8aa2b55c503de70d5a7c0df1ca499597f3434613/tools/charset.py#L17

at minimum for B&W radios to show those 'special' Danish characters properly. There may be other stuff that's needed, but that is all that is jumping out at me atm.

pfeerick avatar Sep 02 '22 08:09 pfeerick

Hi @ulfhedlund Thank you for your support with this case. Danish characters are now drawn with Paint, and the files must exist in radio\src\fonts\sqt5 and radio\src\fonts\std and refered in fonts.cpp and utf8.cpp :-) https://github.com/EdgeTX/edgetx/pull/2271

HThuren avatar Sep 07 '22 14:09 HThuren