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. How to Get chinese text from rtf in messagebox .

How to Get chinese text from rtf in messagebox .

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
6 Posts 3 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.
  • J Offline
    J Offline
    johnalek
    wrote on last edited by
    #1

    Hi In my system not installed languagepack.when i paste chinese characters in rtf .. In sending i wrote this code... m_chattext.GetWindowText(m_Text); AfxMessageBox(m_Text); here m_chattext is rtf object. in messagebox the chinese characters are not displaying..its coming ???? how i can solve this problem ...plz tell...

    #sanroop#

    M 1 Reply Last reply
    0
    • J johnalek

      Hi In my system not installed languagepack.when i paste chinese characters in rtf .. In sending i wrote this code... m_chattext.GetWindowText(m_Text); AfxMessageBox(m_Text); here m_chattext is rtf object. in messagebox the chinese characters are not displaying..its coming ???? how i can solve this problem ...plz tell...

      #sanroop#

      M Offline
      M Offline
      Matthew Faithfull
      wrote on last edited by
      #2

      There is no one thing, hence your difficulty in getting this question answered. Do you understand about Unicode I wonder? You need to compile your application with UNICODE and _UNICODE defined so that AfxMessageBox maps to AfxMessageBoxW, which is capable of displaying Chinese characters if and only if the default system font that it uses, (depends on XP or Vista etc) contains those characters. Then you need to make sure that you are using wide character variables (wchar_t, TCHAR if UNICODE is defined) to both get the data form the clipboard and pass it to the message box so that you don't loose data along the way. That's if the clipboard is giving you wide character data in the first place. You might have to request a different format, or do conversion from a specific Chinese code page. Do you know about Code pages? You can see that there is rather a lot going on here already and this may not be the end of the story as you're involving RTF as well. To get a more definitive answer you'll need to give better information on what you already understand and what you're actually doing, a few lines of code would be good, and be prepared to ask a series of smaller questions to get all the info you need.

      Nothing is exactly what it seems but everything with seems can be unpicked.

      M 2 Replies Last reply
      0
      • M Matthew Faithfull

        There is no one thing, hence your difficulty in getting this question answered. Do you understand about Unicode I wonder? You need to compile your application with UNICODE and _UNICODE defined so that AfxMessageBox maps to AfxMessageBoxW, which is capable of displaying Chinese characters if and only if the default system font that it uses, (depends on XP or Vista etc) contains those characters. Then you need to make sure that you are using wide character variables (wchar_t, TCHAR if UNICODE is defined) to both get the data form the clipboard and pass it to the message box so that you don't loose data along the way. That's if the clipboard is giving you wide character data in the first place. You might have to request a different format, or do conversion from a specific Chinese code page. Do you know about Code pages? You can see that there is rather a lot going on here already and this may not be the end of the story as you're involving RTF as well. To get a more definitive answer you'll need to give better information on what you already understand and what you're actually doing, a few lines of code would be good, and be prepared to ask a series of smaller questions to get all the info you need.

        Nothing is exactly what it seems but everything with seems can be unpicked.

        M Offline
        M Offline
        Maxwell Chen
        wrote on last edited by
        #3

        A non-Unicode program can display Chinese text in MBCS way. But two premises are required:

        1. The system should be Chinese character set installed (for viewing with IE and other text applications).
        2. The text buffer to output or to input in the source code should not contain a second character set (for example a mix of Chinese and Japanese). Otherwise when you are about to save the .cpp file to compile, VC++ prompts and forces you to save the file in Unicode.


        Maxwell Chen

        M M 2 Replies Last reply
        0
        • M Matthew Faithfull

          There is no one thing, hence your difficulty in getting this question answered. Do you understand about Unicode I wonder? You need to compile your application with UNICODE and _UNICODE defined so that AfxMessageBox maps to AfxMessageBoxW, which is capable of displaying Chinese characters if and only if the default system font that it uses, (depends on XP or Vista etc) contains those characters. Then you need to make sure that you are using wide character variables (wchar_t, TCHAR if UNICODE is defined) to both get the data form the clipboard and pass it to the message box so that you don't loose data along the way. That's if the clipboard is giving you wide character data in the first place. You might have to request a different format, or do conversion from a specific Chinese code page. Do you know about Code pages? You can see that there is rather a lot going on here already and this may not be the end of the story as you're involving RTF as well. To get a more definitive answer you'll need to give better information on what you already understand and what you're actually doing, a few lines of code would be good, and be prepared to ask a series of smaller questions to get all the info you need.

          Nothing is exactly what it seems but everything with seems can be unpicked.

          M Offline
          M Offline
          Maxwell Chen
          wrote on last edited by
          #4

          A non-Unicode program can display Chinese text in MBCS way. But two premises are required: 1. The system should be Chinese character set installed (for viewing with IE and other text applications). 2. The text buffer to output or to input in the source code should not contain a second character set (for example a mix of Chinese and Japanese). Otherwise when you are about to save the .cpp file to compile, VC++ prompts and forces you to save the file in Unicode.


          Maxwell Chen

          1 Reply Last reply
          0
          • M Maxwell Chen

            A non-Unicode program can display Chinese text in MBCS way. But two premises are required:

            1. The system should be Chinese character set installed (for viewing with IE and other text applications).
            2. The text buffer to output or to input in the source code should not contain a second character set (for example a mix of Chinese and Japanese). Otherwise when you are about to save the .cpp file to compile, VC++ prompts and forces you to save the file in Unicode.


            Maxwell Chen

            M Offline
            M Offline
            Matthew Faithfull
            wrote on last edited by
            #5

            Indeed but I think in this case 1. is scuppered by the lack of a language pack and 2. can't be gaurenteed because the data is external input form the clipboard. It could contain anything. Also MBCS is a minefield if you don't already understand Unicode and Code Pages. It's pretty treacherous even if you do :)

            Nothing is exactly what it seems but everything with seems can be unpicked.

            1 Reply Last reply
            0
            • M Maxwell Chen

              A non-Unicode program can display Chinese text in MBCS way. But two premises are required:

              1. The system should be Chinese character set installed (for viewing with IE and other text applications).
              2. The text buffer to output or to input in the source code should not contain a second character set (for example a mix of Chinese and Japanese). Otherwise when you are about to save the .cpp file to compile, VC++ prompts and forces you to save the file in Unicode.


              Maxwell Chen

              M Offline
              M Offline
              Maxwell Chen
              wrote on last edited by
              #6

              The lines last far too long, but the horizontal scroll bar does not show up. I can not reach the "Edit" button to modify the post.


              Maxwell Chen

              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