开发者

Unicode problem with CStdioFile in VC++

开发者 https://www.devze.com 2023-02-02 19:36 出处:网络
I am trying to read in a URL such as http://google.com The Url is opened fined, and as soon as I read in the first line in the while(...)loop, instead of getting some 开发者_如何转开发sensible charac

I am trying to read in a URL such as http://google.com The Url is opened fined, and as soon as I read in the first line in the while(...) loop, instead of getting some 开发者_如何转开发sensible characters representing html, I get weird Chinese characters into sCurlLine which is a CString. I think i am missing a unicode encoding/decoding part. The following is the simple code that reads a URL. The while loop reads line by line the file and the text is then updated into a text box.

Thanks for the help

  void CInetSessionDlg::OnBnClickedBurl()
    {
     CStdioFile * fpUrlFile;
     CString sCurlLine;
     UpdateData(TRUE);
     LPCTSTR url = m_sURL;
     fpUrlFile = m_misSession.OpenURL(url);

     if(fpUrlFile)
     {
      while(fpUrlFile->ReadString(sCurlLine))
      {
       m_sResult += sCurlLine;
       UpdateData(FALSE);
      }
     }

    }


Check that you are building is configured to use the correct project configuration settings. Setting found: Project Properties|General|Project Defaults|Character Set

Maybe you have the wrong set "Not Set" | "Use Unicode"

0

精彩评论

暂无评论...
验证码 换一张
取 消