代码如下:
DWORD flag=INTERNET_FLAG_NO_AUTO_REDIRECT;
CInternetSession m_session("my session)");
CHttpConnection *m_conn=NULL;
CHttpFile *m_file=NULL;
CString servername,serverobject;
INTERNET_PORT port;
DWORD type;
AfxParseURL(URLstr,type,servername,serverobject,port); m_conn=m_session.GetHttpConnection(servername,port);
m_file=m_conn->OpenRequest(CHttpConnection::HTTP_VERB_POST,serverobject,NULL,1,NULL,NULL,flag);
m_file->SendRequest(); CString msg;
TCHAR chr[1024];
while (m_file->ReadString(chr,1023))
{
msg.Format("%s",chr);
MessageBox(msg,NULL,MB_OK);
};希望能给出详细的解决代码,谢谢

解决方案 »

  1.   

    如果是utf-8编码的 可以按照下面转换
    int n=MultiByteToWideChar(CP_UTF8,0,strThis,strThis.GetLength(),NULL,0);
    WCHAR * pChar = new WCHAR[n+1];
    n=MultiByteToWideChar(CP_UTF8,0,strThis,strThis.GetLength(),pChar,n);
    pChar[n] = 0; strThis = W2A(pChar);
    delete []pChar; strThis.Replace(strURLTag," content=\"text/html; charset=gb2312\"");
    其中strURLTag是找到的" content="text/html; charset=uft-8""
      

  2.   

    This function maps a character string to a wide-character (Unicode) string. The character string mapped by this function is not necessarily from a multibyte character set.
      

  3.   

    感谢 UnrealCloud() 的答复,但是我的工程中W2A(pChar);部分编译出错,error C2065: '_lpw' : undeclared identifier。另外,strURLTag值应该是什么?
    谢谢
      

  4.   

    UTF-8 转为UNICODE
    能不能给出详细代码?
    谢谢
      

  5.   

    UTF-8 转为UNICODE  你可以在网上搜一下嘛
      

  6.   

    使用UNICODE 就可以解决,所有字符都2个字节.主要是取字符的时候中文被截断(中文2字节)所导致.
      

  7.   

    http://www.vckbase.com/document/viewdoc/?id=1444