by foldr · 2d ago · 0 comments
That's not really how unicode support works. It can be useful to have a specific type for storing unicode code points (like Go's 'rune' type), but strings are generally UTF-8 encoded these days, so having a wide char type plays at most a marginal role in a language's unicode support.
E.g. in Java a char is 16 bit while strings are encoded as 8 bit or 16 bit. (If the string only contains Latin1 chars, it will use 8 bit encoding to save memory).
The char type should be what you use while looking at a single decoded character (e.g. when parsing text files), not how you encode it in a string.