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. Managed C++/CLI
  4. Displaying Chinese Characters

Displaying Chinese Characters

Scheduled Pinned Locked Moved Managed C++/CLI
xmlquestionannouncement
2 Posts 2 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.
  • T Offline
    T Offline
    T RATHA KRISHNAN
    wrote on last edited by
    #1

    Hi! I've set the Text to my label from an XML file. I need to set a chinese word to a label. Here is my XML file contents:

    <?xml version="1.0" encoding="UTF-8" ?>
    <Remember>游戏目的是使两手牌的点数越比庄家接近</Remember>

    The chinese word is for test purpose only(may not be meaningful word). Here is my code for reading this tag and setting the text to a label.

    		 XmlDocument ^ Config = gcnew XmlDocument;
    	
    		 if(System::IO::File::Exists("Config.xml"))
    		 {
    			 Config->Load("Config.xml");
    		 }
    		 XPathNavigator ^ nav = Config->CreateNavigator();
    		 XPathNodeIterator ^ iter;
                         iter = nav->Select("download/Remember");
    		 while(iter->MoveNext())
    		 {
    			 System::String ^ ConfigText = iter->Current->Value;
    			 ConfigText->Trim();
    		 }
    		 System::Runtime::InteropServices::Marshal::StringToHGlobalUni(ConfigText);
    		 m\_pRemember->Text = ConfigText;
    

    While I execute the program only boxes are displayed in place of the chinese characters. If I open the XML file in a browser, the chinese characters are displayed. What else to do to display the chinese language?

    J 1 Reply Last reply
    0
    • T T RATHA KRISHNAN

      Hi! I've set the Text to my label from an XML file. I need to set a chinese word to a label. Here is my XML file contents:

      <?xml version="1.0" encoding="UTF-8" ?>
      <Remember>游戏目的是使两手牌的点数越比庄家接近</Remember>

      The chinese word is for test purpose only(may not be meaningful word). Here is my code for reading this tag and setting the text to a label.

      		 XmlDocument ^ Config = gcnew XmlDocument;
      	
      		 if(System::IO::File::Exists("Config.xml"))
      		 {
      			 Config->Load("Config.xml");
      		 }
      		 XPathNavigator ^ nav = Config->CreateNavigator();
      		 XPathNodeIterator ^ iter;
                           iter = nav->Select("download/Remember");
      		 while(iter->MoveNext())
      		 {
      			 System::String ^ ConfigText = iter->Current->Value;
      			 ConfigText->Trim();
      		 }
      		 System::Runtime::InteropServices::Marshal::StringToHGlobalUni(ConfigText);
      		 m\_pRemember->Text = ConfigText;
      

      While I execute the program only boxes are displayed in place of the chinese characters. If I open the XML file in a browser, the chinese characters are displayed. What else to do to display the chinese language?

      J Offline
      J Offline
      John Schroedl
      wrote on last edited by
      #2

      Where are you displaying the text and seeing the boxes? To the console? To a TextBox or TextBlock? If they are going to the console, then it probably makes sense that you'd see boxes as the console font is probably not set properly to a font with those characters. Use the system menu to change the font to a unicode font and try again if that's the case. If it's to a textbox, again, check the typeface you're using. The browser is probably dynamically loading the font glyphs it needs and painting with those. John

      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