users@jersey.java.net

Impossibility to set charset - Is it a bug?

From: Christian Helmbold <christian.helmbold_at_yahoo.de>
Date: Sun, 8 Aug 2010 03:49:57 -0700 (PDT)

Hello, shouldn't it be possible to specify the charset with @Produces("text/html; charset="UTF-8")? It doesn't work, Jersey still sends "Content-Type: text/html" without the charset parameter. As a workaround a tried to set the Content-Type header by modifying the httpHeaders map in the writeTo method of my MessageBodyWriter. But then I've got only the charset as the content type without the media type. I tried this: httpHeaders.add("Content-Type", "; charset=UTF-8"); and httpHeaders.add("Content-Type", "charset=UTF-8"); I've thought that I could connect multiple values of a header this way. The only workaround I've found is this: httpHeaders.putSingle("Content-Type", mediaType + "; charset=UTF-8"); Christian -- http://scala-forum.org/