• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Displaying Non-English Characters in XML attribute

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I try to convert data in table Products from SqL Server's Nortwind database into XML format. I use ASP to get the data and write the XML tag to the browser. Regarding the specification, I have to fill the value (i.e. Product name) into atrribute, so the XML structure would look like this:
<Product Definition="XXXProduct" listprice="21" id="Item41" parentCategories="Item4">
<Field fieldID="ProductID" fieldValue="11" />
<Field fieldID="ProductName" fieldValue="xxx" />
.....
</Product>
The FieldID is the column name in the Product table and fieldValue is its corresponding value.
When I encounter non-English Characters in ProductName Field, the browser (IE5+) throws an Error: "an invalid character was found..."
If I remove all non-English characters in the table then everything works fine.
So how to solve non-English characters and maybe any special characters in XML?
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you specify encoding attribute in xml declaration:
<?xml version="1.0" encoding="..."?>
If specified encoding is different from actual, you will get an error message. If you did not specify any encoding, UTF8/UTF-16 is assumed and if actual encoding is different from UTF8... then see the sentence above.
This link will give more details: http://www.w3schools.com/xml/xml_encoding.asp
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
0while writing in browser using asp include
like this response.write(server.htmlencode(the xml value))
this will work.
i also faced the above problem
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic