mfc项目的字符集为unicode字符集

乱码前代码:

CString rspStr = pHttpReq->ResponseText;
MessageBox(rspStr);

乱码效果:

 vc++使用IWinHttpRequest获取网页内容乱码

 

解决方法: 

 _variant_t varRspBody = pHttpReq->GetResponseBody();
 //ULONG dataLen = varRspBody.parray->rgsabound[0].cElements; // 文本长度
 char *pContentBuffer = (char*)varRspBody.parray->pvData;
 CString rspStr;
 rspStr = pContentBuffer;

效果:

vc++使用IWinHttpRequest获取网页内容乱码

 

相关文章:

  • 2021-09-20
  • 2021-10-04
  • 2022-12-23
  • 2021-12-24
  • 2021-11-17
  • 2021-09-09
  • 2021-08-01
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-13
  • 2021-11-03
  • 2021-07-08
  • 2021-09-27
相关资源
相似解决方案