Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Unicode support

Unicode support

Scheduled Pinned Locked Moved C / C++ / MFC
com
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kk tvm
    wrote on last edited by
    #1

    Hi friends I have a program which reads a file from web. That file contains unicode (UTF-8) chars. I used below code for my operation, but it shows junk chars while reading file, please suggest a solution to me.

    CInternetSession InternetSession;
    CStdioFile *httpFile;
    CString str;

    httpFile = InternetSession.OpenURL("www.mysite.com");
    while( httpFile->ReadString( str ) )
    {
    AfxMessageBox( str );
    }

    thanks in advance

    -kk.tvm-

    G L S 3 Replies Last reply
    0
    • K kk tvm

      Hi friends I have a program which reads a file from web. That file contains unicode (UTF-8) chars. I used below code for my operation, but it shows junk chars while reading file, please suggest a solution to me.

      CInternetSession InternetSession;
      CStdioFile *httpFile;
      CString str;

      httpFile = InternetSession.OpenURL("www.mysite.com");
      while( httpFile->ReadString( str ) )
      {
      AfxMessageBox( str );
      }

      thanks in advance

      -kk.tvm-

      G Offline
      G Offline
      Game point
      wrote on last edited by
      #2

      try httpFile = InternetSession.OpenURL(L"www.mysite.com");

      :~ Failure is Success If we learn from it!!:~

      K 1 Reply Last reply
      0
      • G Game point

        try httpFile = InternetSession.OpenURL(L"www.mysite.com");

        :~ Failure is Success If we learn from it!!:~

        K Offline
        K Offline
        kk tvm
        wrote on last edited by
        #3

        Hi I changed my code to above. But still message box displaying in chineese/jappaneese language string thanks in advance

        -kk.tvm-

        1 Reply Last reply
        0
        • K kk tvm

          Hi friends I have a program which reads a file from web. That file contains unicode (UTF-8) chars. I used below code for my operation, but it shows junk chars while reading file, please suggest a solution to me.

          CInternetSession InternetSession;
          CStdioFile *httpFile;
          CString str;

          httpFile = InternetSession.OpenURL("www.mysite.com");
          while( httpFile->ReadString( str ) )
          {
          AfxMessageBox( str );
          }

          thanks in advance

          -kk.tvm-

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          First problem you have is that UTF-8 is not Unicode; which one is your file? I am not an MFC expert, so you need to check whether Cstring and CStdioFile need any settings to indicate the character type of the data.

          MVP 2010 - are they mad?

          1 Reply Last reply
          0
          • K kk tvm

            Hi friends I have a program which reads a file from web. That file contains unicode (UTF-8) chars. I used below code for my operation, but it shows junk chars while reading file, please suggest a solution to me.

            CInternetSession InternetSession;
            CStdioFile *httpFile;
            CString str;

            httpFile = InternetSession.OpenURL("www.mysite.com");
            while( httpFile->ReadString( str ) )
            {
            AfxMessageBox( str );
            }

            thanks in advance

            -kk.tvm-

            S Offline
            S Offline
            Stuart Dootson
            wrote on last edited by
            #5

            You need to convert the UTF-8 to whatever encoding you're using for CString. Have a look at this article[^]...

            Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups