C++通过ANE发送中文字符串到AS防止乱码的处理

来源:互联网 发布:淘宝抢购软件 编辑:程序博客网 时间:2024/06/06 07:03
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);
0 0
原创粉丝点击