1 2 3 4 5 6 7 8 9 10 11
|
//Unicode vers UTF-8
int UTF8Chars = WideCharToMultiByte(CP_UTF8, 0, orgUnicode, wcslen(orgUnicode), 0, 0, 0, 0);
LPSTR UTF8Buffer = (LPSTR)alloca(UTF8Chars);
WideCharToMultiByte(CP_UTF8, 0, orgUnicode, wcslen(orgUnicode), UTF8Buffer, UTF8Chars, 0, 0);
//UTF-8 vers Unicode
int InputChars = strlen(UTF8Buffer);
int UnicodeChars = MultiByteToWideChar(CP_ACP, 0, UTF8Buffer, InputChars, 0, 0);
LPWSTR UnicodeBuffer = (LPWSTR)alloca(UnicodeChars*sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, UTF8Buffer, InputChars, UnicodeBuffer, UnicodeChars); |
Partager