Let's say I have the following:
Code:
#include <windows.h>
int main(void)
{
wchar_t wcmsg1[100];
wchar_t wcmsg2[100];
char msg[] = "Hello \253 Hello";
int n;
n = MultiByteToWideChar(CP_ACP,0,msg, strlen(msg),wcmsg1,100);
wcmsg1[n] = 0;
n = MultiByteToWideChar(CP_UTF8,0,msg, strlen(msg),wcmsg2,100);
wcmsg2[n] = 0;
MessageBoxW(NULL,wcmsg1,L"wcmsg1",0);
MessageBoxW(NULL,wcmsg2,L"wcmsg2",0);
return 0;
}
Why does MultiByteToWideChar() drop the \253 character when you encode from UTF8? I was under the impression that UTF8 was completely backwards compatible to char strings, but this doesn't seem to be the case. Any unicode gurus know what is going on here?