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;
效果: