Multibyte strings

So… I’m used to oldschool strings where every character is a byte and if you wanted a smiley face you used colon dash parentheses. LVGL provides the nice symbols in the default fonts usable via LV_SYMBOL_x. These are newfangled multibyte characters.

I have run into a problem where when trying to use text selection on a label to provide highlighting that LVGL counts in logical characters, but if I use the standard C functions for things like string length, it counts bytes as expected.

I am trying to figure out how best to handle this. I don’t know enough about multibyte text (not to be confused with wide characters) and I’m hoping others with more experience with multibyte text can point me in the right direction. Essentially, I’m looking for a strlen function that counts logical characters not bytes.

Thanks in advance for any (not null) pointers.

It’s not officially part of the public API, but this might be what you’re looking for?

Thanks for pointing me towards that. It looks like the way I have LVGL configured, it is computing based off UTF-8 encoding. If that’s the case, I assume I can use some more generalized UTF-8 libraries rather than hacking away at this to expose that to my application?

Yes; any UTF-8 library should do the trick.