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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Unicode problem

Unicode problem

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorial
11 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.
  • M m_mun

    Hi all, I want to display a special font using UNICODE, in my MFC application. I have used '_UNICODE' in preprocessor. This is my syntax TCHAR **strUnicode; //... wcscpy(strUnicode[0],L"U+0985"); //Bengali unicode of a single charecter After that, i want to display bengali character by print value of 'strUnicode'. But it display 'U+0985'. Can any one told me how to construct 'strUnicode' and to display charecter. Thanks to all

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

    Try using something like that:

    std::wstring str = L"Special letters: \u0985";
    MessageBox(NULL,str.c_str(),L"Caption",MB_OK);

    Life is a stage and we are all actors!

    N 1 Reply Last reply
    0
    • L Lost User

      Try using something like that:

      std::wstring str = L"Special letters: \u0985";
      MessageBox(NULL,str.c_str(),L"Caption",MB_OK);

      Life is a stage and we are all actors!

      N Offline
      N Offline
      Nemanja Trifunovic
      wrote on last edited by
      #3

      Almost :)

      std::wstring str = L"Special letters: \x0985";
      MessageBox(NULL,str.c_str(),L"Caption",MB_OK);

      utf8-cpp

      L 1 Reply Last reply
      0
      • M m_mun

        Hi all, I want to display a special font using UNICODE, in my MFC application. I have used '_UNICODE' in preprocessor. This is my syntax TCHAR **strUnicode; //... wcscpy(strUnicode[0],L"U+0985"); //Bengali unicode of a single charecter After that, i want to display bengali character by print value of 'strUnicode'. But it display 'U+0985'. Can any one told me how to construct 'strUnicode' and to display charecter. Thanks to all

        CPalliniC Offline
        CPalliniC Offline
        CPallini
        wrote on last edited by
        #4

        Shaheen.India wrote:

        wcscpy(strUnicode[0],L"U+0985");

        Should be

        wcscpy(strUnicode[0],L"\x0985");

        :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        In testa che avete, signor di Ceprano?

        M 1 Reply Last reply
        0
        • CPalliniC CPallini

          Shaheen.India wrote:

          wcscpy(strUnicode[0],L"U+0985");

          Should be

          wcscpy(strUnicode[0],L"\x0985");

          :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          M Offline
          M Offline
          m_mun
          wrote on last edited by
          #5

          Thanks, It works fine

          1 Reply Last reply
          0
          • N Nemanja Trifunovic

            Almost :)

            std::wstring str = L"Special letters: \x0985";
            MessageBox(NULL,str.c_str(),L"Caption",MB_OK);

            utf8-cpp

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

            :confused:Is there any difference between \x20AC and \u20AC for example ? Characters size or code page issues or other? I've thought they display exactly the same and wcscmp confirmed that produced strings are identical.

            Life is a stage and we are all actors!

            N 1 Reply Last reply
            0
            • L Lost User

              :confused:Is there any difference between \x20AC and \u20AC for example ? Characters size or code page issues or other? I've thought they display exactly the same and wcscmp confirmed that produced strings are identical.

              Life is a stage and we are all actors!

              N Offline
              N Offline
              Nemanja Trifunovic
              wrote on last edited by
              #7

              Hristo Bojilov wrote:

              Is there any difference between \x20AC and \u20AC for example ?

              The former is a character escape for a hex number - the later is not a valid C/C++ escape character[^]. [EDIT] But MS VC++ happily compiled it - apparently, a MS-specific extension [^]: "If a backslash precedes a character that does not appear in the table, the compiler handles the undefined character as the character itself. For example, \c is treated as an c." Funny :) [/EDIT]

              utf8-cpp

              modified on Monday, October 26, 2009 11:34 AM

              D L 2 Replies Last reply
              0
              • N Nemanja Trifunovic

                Hristo Bojilov wrote:

                Is there any difference between \x20AC and \u20AC for example ?

                The former is a character escape for a hex number - the later is not a valid C/C++ escape character[^]. [EDIT] But MS VC++ happily compiled it - apparently, a MS-specific extension [^]: "If a backslash precedes a character that does not appear in the table, the compiler handles the undefined character as the character itself. For example, \c is treated as an c." Funny :) [/EDIT]

                utf8-cpp

                modified on Monday, October 26, 2009 11:34 AM

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

                Nemanja Trifunovic wrote:

                But MS VC++ happily compiled it...

                I got C4129 from VS6.

                "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                N 1 Reply Last reply
                0
                • D David Crow

                  Nemanja Trifunovic wrote:

                  But MS VC++ happily compiled it...

                  I got C4129 from VS6.

                  "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                  N Offline
                  N Offline
                  Nemanja Trifunovic
                  wrote on last edited by
                  #9

                  DavidCrow wrote:

                  I got C4129 from VS6

                  So we found a case where VC6 is more standard-compliant than VC10 Beta 2 :)

                  utf8-cpp

                  N 1 Reply Last reply
                  0
                  • N Nemanja Trifunovic

                    DavidCrow wrote:

                    I got C4129 from VS6

                    So we found a case where VC6 is more standard-compliant than VC10 Beta 2 :)

                    utf8-cpp

                    N Offline
                    N Offline
                    Nemanja Trifunovic
                    wrote on last edited by
                    #10

                    What do you know? I just found out about Universal character names[^]. They are not escape sequences, but can be used to enter various international characters.

                    utf8-cpp

                    1 Reply Last reply
                    0
                    • N Nemanja Trifunovic

                      Hristo Bojilov wrote:

                      Is there any difference between \x20AC and \u20AC for example ?

                      The former is a character escape for a hex number - the later is not a valid C/C++ escape character[^]. [EDIT] But MS VC++ happily compiled it - apparently, a MS-specific extension [^]: "If a backslash precedes a character that does not appear in the table, the compiler handles the undefined character as the character itself. For example, \c is treated as an c." Funny :) [/EDIT]

                      utf8-cpp

                      modified on Monday, October 26, 2009 11:34 AM

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

                      OK.Thanks for your feedback. My best regards. :) [EDIT] I wondered why I used \u but I've discovered that it's C# equivalent [^] of the C++ syntax i.e C# routine.

                      Life is a stage and we are all actors!

                      modified on Monday, October 26, 2009 2:58 PM

                      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