473,324 Members | 2,581 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 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 2823

"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" encoding="UTF-8"?> <test> <chinese>¼»</chinese>...
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 Xalan) to selectively render localized strings...
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 following is my code, Does anyone know how to...
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 and am using the XmlDocument.Load(string...
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 able to see chinese characters when displayed as...
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 file I have: <globalization...
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 that reads this in and transforms against an...
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 unicode document is read into the program, then the...
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" turn into Chinese characters. If I take a look...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.