aspose file tools*
The moose likes Web Services and the fly likes Enoding issue of response from a web service for non english characters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Enoding issue of response from a web service for non english characters" Watch "Enoding issue of response from a web service for non english characters" New topic
Author

Enoding issue of response from a web service for non english characters

Rashmi Anand
Greenhorn

Joined: Feb 10, 2009
Posts: 11
Hi,

I am facing an issue in the response recieved from a webservice.
Non english characters like ô ä are coming as ? ? in the xml.

In the schema definition i have this-
"<?xml version='1.0' encoding='ISO-8859-1'?>".
I have changed it encoding to UTF-8 but with no difference.

This issue in particular i am facing in ALSB proxy service.
Did a exhaustive search in the net also.
Highly appreciate any inputs.

Thanks,
Rashmi.
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
As that XML is served over HTTP the encoding specified in the Content-Type HTTP header is actually more important - it can override the encoding specified in the XML prolog.
See: XML on the Web Has Failed

Rashmi Anand wrote:Non english characters like ô ä are coming as ? ? in the xml.

That may indicate that the real encoding is us-ascii, not UTF-8.
So somewhere your UTF-8 content is being forced into us-ascii encoding so that the non-english characters are replaced with "?".
While us-ascii content can be labeled as UTF-8, us-ascii is not capable of expressing all the characters in UTF-8.
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1180
The characters ô and ä have Latin-1 decimal codes of 212 and 196 respectively. You can see it at ISO Latin-1 Character Set. It means that in your case these two characters are most likely encoded as either Latin-1 or UTF-8.

One thing you can try is to catch these characters as you receive them and pass them through a converter.

Please let us know.

Peer, it's disheartening to realize that in the one transmission we can have multiple encoding definitions – HTTP, XML. Does the mime wrapper introduce something as well?

Regards,
Dan

William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1180
Rashmi,

It would be very nice to capture and see the entire HTTP response message.

To illustrate what Peer said, please have a look at SOAP HTTP Binding. In one example it shows the charset=utf-8 as part of the HTTP header.

Regards,
Dan
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1180
Some more examples are at this guide.

For some reason, most of the examples don't use the XML declaration - <?xml version='1.0' encoding='UTF-8'?>

Regards,
Dan
 
 
subject: Enoding issue of response from a web service for non english characters