By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,124 Members | 1,602 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,124 IT Pros & Developers. It's quick & easy.

How to pass Chinese characters from XML to a web page control

P: n/a
I need some suggestions regarding a problem I am facing. I have a web
page (asp.net and C#) which containing Chinese characters. In my
web.config file I have:

<globalization
requestEncoding="iso-8859-1"
responseEncoding="iso-8859-1"
fileEncoding="iso-8859-1"
/>

and I also put

Response.Charset="chinese";

in the page_load event.

I hard-coded some of the Chinese characters in my aspx page and save it
using "save with encoding". The hard-coded Chinese strings look OK
when the page is loaded. My problem is when I try update some of them
with the data I got from an XML file, they become "?????????" after
the update. Here is the sample code I have:

XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath("abf_c.xml"));

XmlNode myNode = doc.DocumentElement.SelectSingleNode("//Pro[@Model='"
+ lblModel.Text + "']");
string spects=myNode.InnerText.ToString();
lblSpects.Text= spects;

In debug mode I can see that spcts has the right Chinese character, but
when the page is loaded label control lblSpects conatians "????????".

Any idea how to get around it?
Thanks in advance.

MT

Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
If I were you, I would use UTF-8 instead of from the beginning to the end,
including taking the precaution of saving files in UTF-8 with Signature.

There is also a newsgroup about localization:
microsoft.public.dotnet.internationalization .

S. L.

<wt******@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I need some suggestions regarding a problem I am facing. I have a web
page (asp.net and C#) which containing Chinese characters. In my
web.config file I have:

<globalization
requestEncoding="iso-8859-1"
responseEncoding="iso-8859-1"
fileEncoding="iso-8859-1"
/>

and I also put

Response.Charset="chinese";

in the page_load event.

I hard-coded some of the Chinese characters in my aspx page and save it
using "save with encoding". The hard-coded Chinese strings look OK
when the page is loaded. My problem is when I try update some of them
with the data I got from an XML file, they become "?????????" after
the update. Here is the sample code I have:

XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath("abf_c.xml"));

XmlNode myNode = doc.DocumentElement.SelectSingleNode("//Pro[@Model='"
+ lblModel.Text + "']");
string spects=myNode.InnerText.ToString();
lblSpects.Text= spects;

In debug mode I can see that spcts has the right Chinese character, but
when the page is loaded label control lblSpects conatians "????????".

Any idea how to get around it?
Thanks in advance.

MT

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.