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. CStdioFile WriteString (Unicode Strings) failing?

CStdioFile WriteString (Unicode Strings) failing?

Scheduled Pinned Locked Moved C / C++ / MFC
question
7 Posts 5 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
    kiranin
    wrote on last edited by
    #1

    Using CStdioile::WriteString, the Unicode string (having Chinese characters) is not writing into a file.. any suggestions?

    D L A 3 Replies Last reply
    0
    • K kiranin

      Using CStdioile::WriteString, the Unicode string (having Chinese characters) is not writing into a file.. any suggestions?

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      kiranin wrote:

      any suggestions?

      What is it doing?

      "Love people and use things, not love things and use people." - Unknown

      "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

      K 1 Reply Last reply
      0
      • D David Crow

        kiranin wrote:

        any suggestions?

        What is it doing?

        "Love people and use things, not love things and use people." - Unknown

        "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

        K Offline
        K Offline
        kiranin
        wrote on last edited by
        #3

        iT IS NOT WRITING ANYTHING ....I HAVE STRING WHICH IS HAVING ENGLISH + CHINESE - WRITING ENGLISH STRING ONLY WHEN CHINESE STARTS ITS WRITES NOTHING

        I 1 Reply Last reply
        0
        • K kiranin

          Using CStdioile::WriteString, the Unicode string (having Chinese characters) is not writing into a file.. any suggestions?

          L Offline
          L Offline
          Loreia
          wrote on last edited by
          #4

          This is what I used in a project few days ago: std::basic_string<TCHAR> sFileContent = _T(""); if (sizeof(TCHAR) > 1) // if wide char sFileContent += 0xFEFF; // this header tells notepad to read file as Unicode sFileContent += _T("My favorite Dave Attell quote: "); sFileContent += _T("Yeah, I know, some people are against drunk driving, "); sFileContent += _T("and I call those people 'the cops'. But you know, "); sFileContent += _T("sometimes, you've just got no choice; those kids gotta get to school!"); // save to file routine

          L 1 Reply Last reply
          0
          • L Loreia

            This is what I used in a project few days ago: std::basic_string<TCHAR> sFileContent = _T(""); if (sizeof(TCHAR) > 1) // if wide char sFileContent += 0xFEFF; // this header tells notepad to read file as Unicode sFileContent += _T("My favorite Dave Attell quote: "); sFileContent += _T("Yeah, I know, some people are against drunk driving, "); sFileContent += _T("and I call those people 'the cops'. But you know, "); sFileContent += _T("sometimes, you've just got no choice; those kids gotta get to school!"); // save to file routine

            L Offline
            L Offline
            Loreia
            wrote on last edited by
            #5

            From MS page Byte order mark Description EF BB BF UTF-8 FF FE UTF-16, little endian FE FF UTF-16, big endian FF FE 00 00 UTF-32, little endian 00 00 FE FF UTF-32, big-endian Note: Microsoft uses UTF-16, little endian byte order.

            1 Reply Last reply
            0
            • K kiranin

              iT IS NOT WRITING ANYTHING ....I HAVE STRING WHICH IS HAVING ENGLISH + CHINESE - WRITING ENGLISH STRING ONLY WHEN CHINESE STARTS ITS WRITES NOTHING

              I Offline
              I Offline
              Iain Clarke Warrior Programmer
              wrote on last edited by
              #6

              THERE IS NO NEED TO SHOUT AT HIM. You said "failing". But imagine you go to the doctor, and say "I am ill", and then say nothing else. Do you expect him to give you a cure for cancer? Or when he says "Oh dear, that must be bad. What are your symptoms", you reply "I AM ILL"? IN WHAT WAY is it failing? Have you tried stepping into the CStdioFile::WriteFile yourself, and tracking your string to see where it goes wrong? Iain.

              Codeproject MVP for C++, I can't believe it's for my lounge posts...

              1 Reply Last reply
              0
              • K kiranin

                Using CStdioile::WriteString, the Unicode string (having Chinese characters) is not writing into a file.. any suggestions?

                A Offline
                A Offline
                Alexandre GRANVAUD
                wrote on last edited by
                #7

                having the same problem here, someone to help ?

                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