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;
}
const char *cRec = GBKToUTF8(***);
FREDispatchStatusEventAsync(dllContext, (const int8_t*)"GET_DATA", (const uint8_t*)cRec);
C++通过ANE发送中文字符串到AS防止乱码的处理
最新推荐文章于 2022-04-07 21:27:41 发布