Reply XML does not display accented characters

Asked

Viewed 571 times

2

I am using Jersey in a WEB application. In this application, I return an XML file to client requests (which are web-browsers). In order to ensure accented character display, I wrote the Produces annotation as follows:

@Produces("text/xml ; charset=UTF-8")

And in fact, in the reply XML, it reads in its header the definition of the charset as UTF-8. The problem is that even so the browser can not present these special characters, appearing some very bizarre things in place. I suspect the problem is in the browser itself, but I have no idea what to do about it.

I appreciate any attempt at help!

  • Make sure the server side is even generating UTF-8 and not another encoding. If you declare UTF-8 but the server is encoding as Latin1, it will give this kind of problem. Try downloading the file instead of viewing in the browser and use a hexa editor to see if accented characters are being received with 1 byte or 2 bytes.

  • Thank you so much for your help! However, I have a question: since Jersey , after producing XML, sends it automatically as a response, as it would save this file?

  • Probably what @epx meant is for you to ask the browser to download the file instead of displaying it, you wouldn’t need to save it directly by its code.

  • @epx do not know how to read these hexa editors, but it seems to me that all characters are encoded as 2 hexa characters (ie 1 byte for each one)

  • @Brunocésar vlw! If you can read the answer above : D

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.