void Gb2312ToUtf8(const char *pcGb2312, std::string & strUtf8)
{
//wchar_t pcUnicode[CHAR_BUFSIZE];
//gb2312 to unicode
int nUnicodeLen = MultiByteToWideChar(CP_ACP, 0, pcGb2312, -1, NULL, 0);
wchar_t * pcUnicode = new wchar_t[nUnicodeLen+1];
memset(pcUnicode, 0, nUnicodeLen * 2 + 2);
MultiByteToWideChar(CP_ACP, 0, pcGb2312, -1, pcUnicode, nUnicodeLen);
//unicode to utf8
int nUtf8Len = WideCharToMultiByte(CP_UTF8, 0, pcUnicode, -1, NULL, 0, NULL, NULL);
char *pcUtf8=new char[nUtf8Len + 1];
memset(pcUtf8, 0, nUtf8Len + 1);
WideCharToMultiByte(CP_UTF8, 0, pcUnicode, -1, pcUtf8, nUtf8Len, NULL, NULL);
strUtf8=pcUtf8;
delete[] pcUtf8;
delete[] pcUnicode;
}
{
//wchar_t pcUnicode[CHAR_BUFSIZE];
//gb2312 to unicode
int nUnicodeLen = MultiByteToWideChar(CP_ACP, 0, pcGb2312, -1, NULL, 0);
wchar_t * pcUnicode = new wchar_t[nUnicodeLen+1];
memset(pcUnicode, 0, nUnicodeLen * 2 + 2);
MultiByteToWideChar(CP_ACP, 0, pcGb2312, -1, pcUnicode, nUnicodeLen);
//unicode to utf8
int nUtf8Len = WideCharToMultiByte(CP_UTF8, 0, pcUnicode, -1, NULL, 0, NULL, NULL);
char *pcUtf8=new char[nUtf8Len + 1];
memset(pcUtf8, 0, nUtf8Len + 1);
WideCharToMultiByte(CP_UTF8, 0, pcUnicode, -1, pcUtf8, nUtf8Len, NULL, NULL);
strUtf8=pcUtf8;
delete[] pcUtf8;
delete[] pcUnicode;
}