When developing RESTful Web services using Jersey you will at some point be forced to define/change the character set and content type of your response. Setting the content type is simply done by using the Produces tag, like so:
At this point it comes in handy to know that Jersey uses UTF-8 as default encoding for response data. BUT it does not specify it explicitely in the response header, which might lead to unexpected results.
So, to make sure target browsers are directed to use your character encoding specifiy it explicitely in your Jersey service. How? Simply add it to the content type as you always do with HTTP headers:
@Produces(MediaType.APPLICATION_JSON + "; charset=utf-8");
That’s all it takes. Easy, right?