472,340 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,340 software developers and data experts.

XML: how to read in chinese characters

Hey there, I'm having trouble reading Simple Chinese characters from an XML
document in an ASP file, I want to update the database based on what is in
the file. Everytime, I read in the characters they come out as ??.
Here's a snippet. Also here is my sample xml file:

http://dev4.labwerks.com/research/1_homepage.xml

Response.Charset = "utf-8"
Set objXML = Server.CreateObject("Microsoft.XMLDOM")
Set objLst = Server.CreateObject("Microsoft.XMLDOM")
Set objHdl = Server.CreateObject("Microsoft.XMLDOM")

objXML.async = False

objXML.Load (Request.ServerVariables( "APPL_PHYSICAL_PATH" ) &
strDirectoryUpload & "\\" & actualName)

If objXML.parseError.errorCode <> 0 Then
' handle the error
intErrorCode = 3
strErrorMessage = "There was a parser error in the xml file."
Else

Set objLst = objXML.getElementsByTagName("item")
noOfHeadlines = objLst.length
If IsNumeric(noOfHeadlines) Then
noOfHeadlines = Clng(noOfHeadlines)
End If
For i = 0 To (noOfHeadlines-1)
Set objHdl = objLst.item(i)

strItemID = objHdl.childNodes(0).text
strTitle = objHdl.childNodes(1).text
strLastUpdate = objHdl.childNodes(2).text
strEventCopy = objHdl.childNodes(3).text
strSortOrder = objHdl.childNodes(4).text
strContent = objHdl.childNodes(5).text
strLanguage1 = objHdl.childNodes(6).text <---- this is where I am
getting the chinese characters.

Jun 26 '06 #1
3 2762

"msnews.microsoft.com" <br***@labwerks.com> wrote in message
news:uB**************@TK2MSFTNGP04.phx.gbl...
Hey there, I'm having trouble reading Simple Chinese characters from an XML document in an ASP file, I want to update the database based on what is in
the file. Everytime, I read in the characters they come out as ??.
Here's a snippet. Also here is my sample xml file:

http://dev4.labwerks.com/research/1_homepage.xml

Response.Charset = "utf-8"
Set objXML = Server.CreateObject("Microsoft.XMLDOM")
Set objLst = Server.CreateObject("Microsoft.XMLDOM")
Set objHdl = Server.CreateObject("Microsoft.XMLDOM")

objXML.async = False

objXML.Load (Request.ServerVariables( "APPL_PHYSICAL_PATH" ) &
strDirectoryUpload & "\\" & actualName)

If objXML.parseError.errorCode <> 0 Then
' handle the error
intErrorCode = 3
strErrorMessage = "There was a parser error in the xml file."
Else

Set objLst = objXML.getElementsByTagName("item")
noOfHeadlines = objLst.length
If IsNumeric(noOfHeadlines) Then
noOfHeadlines = Clng(noOfHeadlines)
End If
For i = 0 To (noOfHeadlines-1)
Set objHdl = objLst.item(i)

strItemID = objHdl.childNodes(0).text
strTitle = objHdl.childNodes(1).text
strLastUpdate = objHdl.childNodes(2).text
strEventCopy = objHdl.childNodes(3).text
strSortOrder = objHdl.childNodes(4).text
strContent = objHdl.childNodes(5).text
strLanguage1 = objHdl.childNodes(6).text <---- this is where I am
getting the chinese characters.


Assuming that the XML file is encoded as UTF-8 (ie. if you open it directly
in a browser or a text editor it looks ok) Then the line above shouldn't be
a problem.

What DB are you using and does the data type of the field you are placing
the text in accept unicode characters?

Anthony.
Jun 27 '06 #2
Hey there, I'm having trouble reading Simple Chinese characters from an XML
document in an ASP file, I want to update the database based on what is in http://dev4.labwerks.com/research/1_homepage.xml

Response.Charset = "utf-8"


Have you tried Response.Charset = "big5"

Earl
www.jhdesigninc.com

Jun 27 '06 #3
For Chinese you have to use a diferent CharSet.

For Chinese Simplified you may use GB2312, GBK, GB18030, HZ ou
ISO-2022-CN and for Chinese Traditional you may use Big5, Big5-HKSCS or
EUC-TW.

Jun 28 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Knackeback | last post by:
Hi, I wrote a XML file with GNU emacs 21.2.2 and with chinese character content encoded in UTF-8. I wrote something like: <?xml version="1.0"...
4
by: mikeyjudkins | last post by:
I have an XML file containing localized strings in 9 languages, encoded in Unicode (UTF-8). Im trying to parse this XML document via XSLT (Apache...
8
by: Agnes | last post by:
In my .net ,i need to generate an xml file , however, user may input a chinese character, Then , the xml will got something unknow characters. the...
1
by: Chief | last post by:
I am unable to load an xml document that contains Chinese characters in an attribute value. I need to load the document into and XmlDocument object...
8
by: pabv | last post by:
Hello all, I am having a few issues with encoding to chinese characters and perhaps someone might be able to assist. At the moment I am only...
1
by: wtistang | last post by:
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...
6
by: Matt Hollingworth | last post by:
We have an XML file that contains text in various languages , ie English, French, German and Chinese etc. We currently have a StringWriter object...
2
by: Frantic | last post by:
I'm working on a list of japaneese entities that contain the entity, the unicode hexadecimal code and the xml/sgml entity used for that entity. A...
2
by: grotgod | last post by:
Hello; I have a pretty interesting problem here. I read an xml file from the server using the fileSystem object. However...the text "magically"...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.