Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > XML: how to read in chinese characters

Reply
Thread Tools

XML: how to read in chinese characters

 
 
msnews.microsoft.com
Guest
Posts: n/a
 
      06-26-2006
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.



 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      06-27-2006

"msnews.microsoft.com" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.


 
Reply With Quote
 
 
 
 
surf_doggie
Guest
Posts: n/a
 
      06-27-2006

> 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

 
Reply With Quote
 
MFedatto
Guest
Posts: n/a
 
      06-28-2006
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
help-> xslt transformation to pdf (chinese characters changed to # characters) omegaman XML 1 09-21-2004 10:44 PM
Re: How do I translate a Chinese web site and add Chinese character set to IE..? =A0 - =A0 Taking these two questions one at a time... =A Patrick Dunford NZ Computing 3 04-28-2004 07:15 PM
Chinese characters in ASP:DropDownList Calvin Lai ASP .Net 0 12-21-2003 09:34 PM
WebForm contain Chinese characters... Simon Chung-Jen Chuang ASP .Net 1 07-04-2003 01:35 PM



Advertisments