- 注册时间
- 2011-3-6
- 最后登录
- 1970-1-1
该用户从未签到
|
- char* GBKToUTF8(const char* strGBK)
- {
- int len=MultiByteToWideChar(CP_ACP, 0, (LPCTSTR)strGBK, -1, NULL,0);
- unsigned short * wszUtf8 = new unsigned short[len+1];
- memset(wszUtf8, 0, len * 2 + 2);
- MultiByteToWideChar(CP_ACP, 0, (LPCTSTR)strGBK, -1, (LPWSTR)wszUtf8, len);
- len = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)wszUtf8, -1, NULL, 0, NULL, NULL);
- char *szUtf8=new char[len + 1];
- memset(szUtf8, 0, len + 1);
- WideCharToMultiByte (CP_UTF8, 0, (LPCWSTR)wszUtf8, -1, (LPSTR)szUtf8, len, NULL,NULL);
- return szUtf8;
- }
复制代码 |
|