It's not a secret anymore!*
The moose likes JSF and the fly likes Ajax response and accented characters (richfaces) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Ajax response and accented characters (richfaces)" Watch "Ajax response and accented characters (richfaces)" New topic

Ajax response and accented characters (richfaces)

Felix Sima
Ranch Hand

Joined: Feb 06, 2008
Posts: 42

I am using richfaces to build my application. Using the <a4j:log/> tag, I can see that the ajax responses containing accented characters (italian characters) give errors during the parsing of xml

The same request/response, using data without accented characters works fine. The document is NOT empty.

The content-type of the response is "Response with content-type: text/xml;charset=UTF-8"
I have checked using XMLSpy that the response is a well formed xml file.

Any idee how to get rid of this error?
Any help will be highly appreciated.
Thank you.

Best regards,
Felix Sima
Ranch Hand

Joined: Feb 06, 2008
Posts: 42

I have found the problem and its solution.
The accented characters were represented by the HTML's special symbols (à, è, etc). But in XML "&" is a reference to an entity. Those entities were not defined in my xml. The solution was to prepend their definition to my xml, like this:

<!DOCTYPE newsletter [
><!ENTITY nbsp " ">
<!ENTITY lt "<">
<!ENTITY igrave "ì">


Best regards,
I agree. Here's the link:
subject: Ajax response and accented characters (richfaces)
Similar Threads
Export to xls file - Download file using AJAX
Head Rush Ajax and JSON
Character display issue in IE
Problem in parsing thru IBM SAX parser API
UTF-8 problem again, but still little diffrent