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. Chinese characters

Chinese characters

Scheduled Pinned Locked Moved C / C++ / MFC
c++designtoolstutorialquestion
15 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.
  • M Michael Dunn

    Put them in a text file - use Notepad and save as Unicode (big endian) for ease of reading. Then open the file in VC in binary mode. --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

    M Offline
    M Offline
    Mortie42
    wrote on last edited by
    #6

    I must be close but... Using your method (thanks), my hex values are \x62a4\x6797. But I get empty boxes. When I use \x2021, I get the double dagger symbol. My code is basically, ... CFont font1; font1.CreateFont(13,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,0,OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|EF_DONTCARE,_T("SimSun") ); Button.SetFont(&font1, TRUE); Button.SetTitle(_L"\x62a4\x6797"); ... What am I missing? Mortie42

    M 1 Reply Last reply
    0
    • M Mortie42

      I must be close but... Using your method (thanks), my hex values are \x62a4\x6797. But I get empty boxes. When I use \x2021, I get the double dagger symbol. My code is basically, ... CFont font1; font1.CreateFont(13,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,0,OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|EF_DONTCARE,_T("SimSun") ); Button.SetFont(&font1, TRUE); Button.SetTitle(_L"\x62a4\x6797"); ... What am I missing? Mortie42

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #7

      You need to set the charset parameter correctly. For Chinese, there two - CHINESEBIG5_CHARSET and GB2312_CHARSET. One is simplified, one is traditional, I can never remember which is which. :-> --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

      M 1 Reply Last reply
      0
      • M Michael Dunn

        You need to set the charset parameter correctly. For Chinese, there two - CHINESEBIG5_CHARSET and GB2312_CHARSET. One is simplified, one is traditional, I can never remember which is which. :-> --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

        M Offline
        M Offline
        Mortie42
        wrote on last edited by
        #8

        Hmmm. I tried both. I compile w/o warnings But I still get two squares and a dagger with (L"\x62a4\x6797\x2021"); . Any ideas? :confused: Mortie42 -- modified at 17:10 Friday 24th March, 2006

        M 1 Reply Last reply
        0
        • M Mortie42

          Hmmm. I tried both. I compile w/o warnings But I still get two squares and a dagger with (L"\x62a4\x6797\x2021"); . Any ideas? :confused: Mortie42 -- modified at 17:10 Friday 24th March, 2006

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #9

          This works for me in a WTL dialog-based app

          LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
          {
          CButton btn = GetDlgItem(IDOK);

          m\_font.CreateFont ( -13, 0, 0, 0, FW\_NORMAL, false, false, false, CHINESEBIG5\_CHARSET, OUT\_DEFAULT\_PRECIS,
                              CLIP\_DEFAULT\_PRECIS, DEFAULT\_QUALITY, DEFAULT\_PITCH|FF\_DONTCARE, \_T("SimSun") );
          
          btn.SetFont ( m\_font );
          btn.SetWindowText ( L"\\x62a4\\x6797" );
          

          //...
          }

          The only change I made was the font size and char set params to CreateFont() --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

          M 1 Reply Last reply
          0
          • M Michael Dunn

            This works for me in a WTL dialog-based app

            LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
            {
            CButton btn = GetDlgItem(IDOK);

            m\_font.CreateFont ( -13, 0, 0, 0, FW\_NORMAL, false, false, false, CHINESEBIG5\_CHARSET, OUT\_DEFAULT\_PRECIS,
                                CLIP\_DEFAULT\_PRECIS, DEFAULT\_QUALITY, DEFAULT\_PITCH|FF\_DONTCARE, \_T("SimSun") );
            
            btn.SetFont ( m\_font );
            btn.SetWindowText ( L"\\x62a4\\x6797" );
            

            //...
            }

            The only change I made was the font size and char set params to CreateFont() --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

            M Offline
            M Offline
            Mortie42
            wrote on last edited by
            #10

            I think I have issues else where. I'm using an old copy of VisualC++6.0 on a new WinXP o/s. I copied the DLL's for Chinese; APPWZCHS.DLL AND APPWZCHT.DLL from disc to machine. I tried making a simple MFC dialog application using these. The dialog box in VC showed one set of gibberish while on compilation and execution, the resulting dialog box had rows of ?'s. I'm taking a break for the weekend but before I go, could you tell me which version of VC and o/s you used? Thx for all the help. PS WTL is ...? Mortie42

            M 1 Reply Last reply
            0
            • M Mortie42

              I think I have issues else where. I'm using an old copy of VisualC++6.0 on a new WinXP o/s. I copied the DLL's for Chinese; APPWZCHS.DLL AND APPWZCHT.DLL from disc to machine. I tried making a simple MFC dialog application using these. The dialog box in VC showed one set of gibberish while on compilation and execution, the resulting dialog box had rows of ?'s. I'm taking a break for the weekend but before I go, could you tell me which version of VC and o/s you used? Thx for all the help. PS WTL is ...? Mortie42

              M Offline
              M Offline
              Michael Dunn
              wrote on last edited by
              #11

              I'm using VC 6 on XP SP2. If you're on a fresh XP you probably don't have the east Asian language support installed. Control Panel-Regional and Language options-languages-Install files for east Asian languages. WTL: clickety[^] --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

              W M 2 Replies Last reply
              0
              • M Michael Dunn

                I'm using VC 6 on XP SP2. If you're on a fresh XP you probably don't have the east Asian language support installed. Control Panel-Regional and Language options-languages-Install files for east Asian languages. WTL: clickety[^] --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

                W Offline
                W Offline
                Waldermort
                wrote on last edited by
                #12

                Writing strings of Chinese in Hex format, urghh!!! It would be ok for very short items, but damn near impossible to read. I am using VC6, with windowsXP SP1, and the MS MultiLingual User Interface (English and Chinese version installed as one). I have no real problems writing chinese text into my code (without using ascii), or displaying it in the application. One point though, I never build Unicode, I always select MBCS. Try making a simple hello world app with a chinese string and play around with the settings until you get it right. If you have further problems I could give you a simple project to test.

                M 1 Reply Last reply
                0
                • M Michael Dunn

                  I'm using VC 6 on XP SP2. If you're on a fresh XP you probably don't have the east Asian language support installed. Control Panel-Regional and Language options-languages-Install files for east Asian languages. WTL: clickety[^] --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

                  M Offline
                  M Offline
                  Mortie42
                  wrote on last edited by
                  #13

                  Thx :-D I had assumed that because I could see the Chinese glyphs in Excel, word and Notepad that all was well. Bad me. With the East Asian Languages set the glyphs appear. :) Mortie42

                  S 1 Reply Last reply
                  0
                  • W Waldermort

                    Writing strings of Chinese in Hex format, urghh!!! It would be ok for very short items, but damn near impossible to read. I am using VC6, with windowsXP SP1, and the MS MultiLingual User Interface (English and Chinese version installed as one). I have no real problems writing chinese text into my code (without using ascii), or displaying it in the application. One point though, I never build Unicode, I always select MBCS. Try making a simple hello world app with a chinese string and play around with the settings until you get it right. If you have further problems I could give you a simple project to test.

                    M Offline
                    M Offline
                    Mortie42
                    wrote on last edited by
                    #14

                    Hi waldermort please send me the project, I value any tips I can get. mmortimer47 at hot mail dot com Mortie42

                    1 Reply Last reply
                    0
                    • M Mortie42

                      Thx :-D I had assumed that because I could see the Chinese glyphs in Excel, word and Notepad that all was well. Bad me. With the East Asian Languages set the glyphs appear. :) Mortie42

                      S Offline
                      S Offline
                      Sheng Jiang
                      wrote on last edited by
                      #15

                      Use the String Table resource, don't put strings in code. My blogs: http://blog.joycode.com/jiangsheng http://blog.csdn.net/jiangsheng http://bloglines.com/public/jiangsheng Command what is yours Conquer what is not ---Kane

                      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