How can I set the charset with JAX-RS? I\'ve tried @Produces(\"text/html; charset=UTF-8\")
but that was ignored and only text/html
was send with th
It is also possible to use ResponseBuilder.header(...) method to set the content type with the charset. See below for a code sample (using JAX-RS 1.1.1, CXF 2.3.1).
final Response myResponse = Response.status(Response.Status.BAD_REQUEST)
.entity("La requête n'est pas correcte.\n ...")
.header(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_PLAIN+"; charset=ISO-8859-15" )
.build();