The project is MFC/Unicode (Use Unicode Character Set). Here is a little code that get strings from an address:
CString sOutput;
CInternetSession session{};
char buffer[256];
CStdioFile file = session.OpenURL(address, 1, INTERNET_FLAG_TRANSFER_ASCII);
while (UINT nRead = file->Read(buffer, sizeof(buffer - 1)))
{
buffer[nRead] = '\0';
sOutput += buffer;
}
The problem is that I got non-unicode string, even if CString
is UNICODE (CStringW
). Example:
înțelege
which is non UNICODE. If I change char
to wchar_t
, I got even worst:
㼼浸敶쳌쳌쳌쳌獲潩㵮
How can adapt the code to read UNICODE?