tcMenu: Bug: Incomplete display involving Chinese character
Case 1:
I set Unit name to “秒1” (a Chinese character + “1”), after uploading, the display only show the Chinese character, “1” is missing. It seems only the first character is shown. However If I only use ASCII for Unit name, everything is fine.
Case 2:
I set row in EnumMenuItem with Chinese character “1分钟”, after uploading, the display only shows “1分”, the last character is missing. However If I only use ASCII for the rows, everything is fine.
I use this font
installMonoBorderedTheme(renderer, MenuFontDef(u8g2_font_wqy12_t_gb2312b, 12), MenuFontDef(u8g2_font_wqy12_t_gb2312b, 12), true);
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (10 by maintainers)
Commits related to this issue
- #238 UTF8 support for U8G2, #255 logging and UI fixes — committed to davetcc/tcMenu by davetcc 2 years ago
If you take a look at https://github.com/davetcc/tcUnicodeHelper you’ll see what I’ve been working on. Based on some old code I’d written for mbed, it now is able to render Unicode properly regardless of the display technology, and even has a new screen in designer to create custom fonts with complete control over the ranges.
I’ve tested it with up to 4 character long sequences.
It will be available as an option for all graphical displays in TcMenu 3.0
I’ve Isolated it into a simple sketch and managed to work out what’s wrong, I’ve fixed the U8G2 renderer so you can switch on UTF-8 encoding from a flag during code generation.
Editing UTF-8 text may be a different proposition, one which would probably be possible for you to implement if needed once I add custom multi-edit soon.
ui.zip This is the files from my project, and I’ve checked the code, the texts are complete.
You may also past these text containing Chinese characters to your experimental menuitems; for enum rows:
1分钟for unit name:秒1