• 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

Ajax and spanish characters

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a simple AJAX call to get a list of names from the database and display it in a selection box. But some of the names contains spanish characters and looks like when that happens, the generated XML is not getting to the front-end. I can see XML is generated on the server side. But Javascript on the client side sees only null values. Anybody had similar problem?

Thanks in Advance.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried to open up the xml document directly into a browser and does it work. If there is a problem with that it normally shows the error.

I have used Northwind which has special charcters in it and have had no problems.

Eric
 
shaju joseph
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply.

I cannot view the generated XML in IE.

Here is a sample from the XML and the error I am getting in the browser.

<?xml version="1.0"?>
<list>
<item>
<id>abcd</id>
<name>Cede�o,xyz</name>
</item>
</item>
</list>

Error message
=============
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

An invalid character was found in text content. Error processing resource 'file:///C:/download/123.xml'. Line 5, Position ...

<name>Cede

Here is the first part of javascript method to parse the XML.

function displaySupervisorList(superXML) {
var list = superXML.getElementsByTagName("list")[0];
var items = list.getElementsByTagName("item");


If I filter the spanish characters at the server, everything is fine.

Thanks again for your help.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried enclosing the data in a CDATA section?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might also want to try specifying the charset encoding on the xml processing statement.
[ January 20, 2006: Message edited by: Bear Bibeault ]
 
shaju joseph
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks guys.

After I put encoding="ISO-8859-1" it works fine.

Thanks again.
reply
    Bookmark Topic Watch Topic
  • New Topic