Diccionario Hanpu
La siguiente es la función para la conversión de UNICODE a ANSI:
void WCharToAChar(wchar_t* wchar, char* str, int size)//UNICODE a ANSI
{
memset(str, 0, tamaño);
Indicador DWORD = WideCharToMultiByte(CP_OEMCP, NULL, wchar, -1, NULL, 0, NULL, FALSE ); p>
p>
WideCharToMultiByte(CP_OEMCP, NULL, wchar, -1, str, flag, NULL, FALSE
}
void ACharToWChar(char*); str, wchar_t* wchar , int tamaño) //ANSI a UNICODE
{
_wcsnset(wchar, 0, tamaño);
DWORD flag = MultiByteToWideChar( CP _ ACP, 0, cadena, -1, NULL, 0);
MultiByteToWideChar (CP_ACP, 0, cadena, -1, wchar, tamaño
}
UTF -8 a UNICODE:
PContent es una matriz de caracteres que contiene contenido de caracteres UTF-8 y Len es su longitud.
int n = MultiByteToWideChar(CP_utf8,0,pContent,Len,NULL,0);
wchar_t * pWideChar =(wchar_t *)calloc(n 1 , sizeof(wchar _ t ));
MultiByteToWideChar(CP_UTF8, 0, pContent, Len, pWideChar, n);
Luego use el WCharToAChar anterior para convertir pContent en Char.