char * CProcessUpdate::utf82gbk( char* strbuf )
{
//utf-8转为Unicode
int size = MultiByteToWideChar(CP_UTF8, 0, strbuf, -1, NULL, 0);
WCHAR *strUnicode = new WCHAR[size];
MultiByteToWideChar(CP_UTF8, 0, strbuf, -1, strUnicode, size);
//Unicode转换成UTF-8;
int i = WideCharToMultiByte(CP_ACP, 0, strUnicode, -1, NULL, 0, NULL, NULL);
char *strGBK = new char[i];
WideCharToMultiByte(CP_ACP, 0, strUnicode, -1, strGBK, i, NULL, NULL);
return strGBK;
}
{
//utf-8转为Unicode
int size = MultiByteToWideChar(CP_UTF8, 0, strbuf, -1, NULL, 0);
WCHAR *strUnicode = new WCHAR[size];
MultiByteToWideChar(CP_UTF8, 0, strbuf, -1, strUnicode, size);
//Unicode转换成UTF-8;
int i = WideCharToMultiByte(CP_ACP, 0, strUnicode, -1, NULL, 0, NULL, NULL);
char *strGBK = new char[i];
WideCharToMultiByte(CP_ACP, 0, strUnicode, -1, strGBK, i, NULL, NULL);
return strGBK;
}