mfc项目的字符集为unicode字符集
乱码前代码:
CString rspStr = pHttpReq->ResponseText;
MessageBox(rspStr);
乱码效果:
解决方法:
_variant_t varRspBody = pHttpReq->GetResponseBody(); //ULONG dataLen = varRspBody.parray->rgsabound[0].cElements; // 文本长度 char *pContentBuffer = (char*)varRspBody.parray->pvData; CString rspStr; rspStr = pContentBuffer;
效果:
原文:http://www.cnblogs.com/hupeng1234/p/6901454.html