1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
#define UNICODE
#include <windows.h>
int main()
{
const char *text = "Русские буковки";
wchar_t *text_1251 = new wchar_t(strlen(text) + 1);
memset(text_1251, 0, (strlen(text) + 1) * sizeof(wchar_t));
MultiByteToWideChar(1251, 0, text, strlen(text), text_1251, strlen(text) + 1);
wchar_t *text_utf16 = new wchar_t(strlen(text) + 1);
memset(text_utf16, 0, (strlen(text) + 1) * sizeof(wchar_t));
MultiByteToWideChar(CP_UTF8, 0, text, strlen(text), text_utf16, strlen(text) + 1);
MessageBox(NULL, text_1251, L"", MB_OK);
MessageBox(NULL, text_utf16, L"", MB_OK);
return 0;
}
|