2022-03-13 05:36 AM
Hi,
A colleague need to send me strings via Uart.
He asked me whether I work with UTF-8, and I was unable to find this information or how to configure it...
(I know that at the end of the day to display it I'll have to convert to Unicode).
Does anyone know?
I work with stm32l496g
Thank you
2022-03-13 05:58 AM
The UART can send any 8-bit values you want to send. What they represent is up to you. UTC-8 is just a superset of ASCII as I recall.
2022-03-13 06:01 AM
yes, but is the 'unsgined char' c datatype encoded with utf-8?
that's what I can't find
2022-03-13 06:11 AM
Guess you'd need to look at the TouchGFX font mappings. C string functions are mostly agnostic, just expect NUL termination, and can work with control characters and extended characters.
Might need to check sort criterion.
Check compiler comand line options.
2022-03-13 05:45 PM
Hello BBlad.1,
You are right, characters in a string in TouchGFX are considered as Unicode characters as 16-bit unsigned integers.
If you want to convert to UTF-8, you can call the functions fromUTF8() or toUTF8() that you can find in Unicode.hpp.
/Alexandre