My strings are all UTF-16, and in UTF-16, L'å' is encoded as a one byte constant, but in UTF-8, it's encoded as two constants. Just copying wchar_t to char isn't going to work. I need to convert my UTF-16 strings to UTF-8 and back.Quote:
I can't help but think that you are going about this the wrong way.
True `UTF8' strings have no embedded nulls. You should get what you set.
What I meant by sensible output is that if I try to print a UTF-8 string, it's not always going to look pretty. But the data is encoded correctly, so as long as I don't print it, I should be fine.
Well, good news is: it works. I made sure to convert all non-UTF16 string literals into UTF-8 ones.