UTF-8 support in libraries
ersmith
Posts: 6,105
I see that SIDE is getting UTF-8 support now (very cool!). I just wanted to mention here that in order to get "full" UTF-8 support from a propeller program, or indeed a program on the PC, you need to use the C setlocale function:
Fortunately the way UTF-8 is constructed this won't matter for many programs (it'll "just work" even without the setlocale), but there are a few cases where there is a difference between ASCII and UTF-8. You'll notice it mainly when converting to/from C wide characters (wchar_t), which on the propeller are 32 bits and can hold any Unicode character in a single wchar_t.
Eric
#include <locale.h> int main(void) { setlocale(LC_ALL, ""); ... }Without this any wide character or multibyte character functions will work in plain ASCII rather than UTF-8.
Fortunately the way UTF-8 is constructed this won't matter for many programs (it'll "just work" even without the setlocale), but there are a few cases where there is a difference between ASCII and UTF-8. You'll notice it mainly when converting to/from C wide characters (wchar_t), which on the propeller are 32 bits and can hold any Unicode character in a single wchar_t.
Eric
Comments
I'm working with @MacTuxLin to produce a full Simplified Chinese SimpleIDE.
Other translations can be easily made by users in their system locale name with the QtLinguist tool.
My second language is Lao (Thai Issan). This gives me an excuse to learn those symbols with my wife.
Thanks,
--Steve