by pcr910303 · 6y ago · 0 comments
How can one process unicode (UTF-8) properly in C? As a CJK person, I wish there was a robust solution. Are there any standardized ways or proposals? (Using wchar doesn't count.)
I recommend heading toward a future where only UTF-8 encoding is used for multibyte characters and UCS-2 or similar for wchar_t. There is no need to support several different encodings.
N2198 2018/01/02 Ballman, Adding the u8 character prefix
I'm of the opinion that wchar_t should become an alias for char32_t.
Basically store the text as char arrays, and convert them when needed. Meanwhile, you could use this single file header: https://github.com/RandyGaul/cute_headers/blob/master/cute_u...
However, the book only describes the available standard functions, so even doing better than other manuals, everything it has to say on this subject fits in one chapter and feel underpowered.
Here are examples of working with unicode in C: https://begriffs.com/posts/2019-05-23-unicode-icu.html