If I have c1, c2 as char variables (such that c1c2 would be the byte sequences for the UTF-8 character), how do I create and print the UTF-8 character?
Similarly for the 3 and 4 byte UTF-8 characters?
I've been trying all kinds of approaches with mbstowcs() but I just can't get it to work.
I managed to write a working example.
When
c1is'\xce'andc2is'\xb8', the result isθ.It turns out that I have to call
setlocalebefore usingmbstowcs.Output:
For 3 or 4 byte utf8 characters, one can use a similar approach.