Strange in UTF8 String


#1

Hi Juce,

I have used URL to get some UTF8 Chinese strings successfully from server, tested by CharPointer_UTF8::isValidString function. I used these codes to get the server returned String:

url.readEntireBinaryStream(block,isOK)
String resultStr = String::fromUTF8((char*)block.getData(),byte);
const wchar_t* wcharptr = test.toWideCharPointer();

When debugging in VS, there’re mess Chinese characters in resultStr value, but wcharptr display the right Chinese characters. How can I generate the right juce::String to display in my APP GUI?

Thanks


#2

The UTF8 stored in the String will be correct, it’s just VS that doesn’t know how to display utf8 properly - it probably treats it as a local 8-bit encoding instead. I’m afraid I don’t know much about VS’s debugger or how you’d improve that.