Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem displaying Chinese character

Status
Not open for further replies.

slok

Programmer
Jul 2, 1999
108
SG
I'm using MSIE5.5 and MSXML v3.

Basically, if I do a File->Open from the browser,
and open the XML file, I can see the Chinese characters.

However, if I loads the XML document through a ASP script,
the Chinese characters are all replaced by question marks.

Any idea what's the problem here?

Following is my code in ASP:

===
Response.Write(&quot;<?xml version=\&quot;1.0\&quot; encoding=\&quot;UTF-8\&quot;?><html><title>loadXML</title><meta content=text/html; charset=UTF-8 />&quot;);




var dom = Server.CreateObject(&quot;MSXML2.DomDocument&quot;);
dom.async = 0;
dom.load(Server.MapPath(&quot;testexport.xml&quot;));


var parseError = dom.parseError;
if (parseError.errorCode != 0) {
var e = new Error(&quot;Error: line &quot; + parseError.line + &quot;; reason = &quot; + parseError.reason);
throw(e);
}





var root = dom.documentElement;
var e, child;
e = new Enumerator(root.childNodes);
for (;!e.atEnd();e.moveNext())
{
child = e.item();
Response.Write(child.text + &quot;<br>&quot;);
}

=====
 
the XML file is able to load with the correct characters locally from the browser
when I do a File->Open.

It display without any errors.

I would definitely think it got to do with either
how ASP treats strings or streams.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top