Note that there are some explanatory texts on larger screens.

plurals
  1. PORESTeasy return different character encoding JSON(P)
    primarykey
    data
    text
    <p>Does anybody know a way to enable response character set selection by client for RESTeasy? I'm working with 1.2.1GA. My responses return UTF-8 although I'm not sure why and where that is defined because my test system's default encoding in java is CP1252-something and the annotations looked like that:</p> <pre><code>@GET @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) </code></pre> <p>I tried to vary these MediaTypes with no success.</p> <pre><code>// Add another media type @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, "application/json;charset=iso-8859-1" } ) // Try to always return latin-1 JSON. TESTING ONLY!!! @Produces( { MediaType.APPLICATION_JSON + ";charset=iso-8859-1", MediaType.APPLICATION_XML } ) </code></pre> <p>I request with REST Client for Firefox setting the charset in the <em>accept</em> and <em>accept-encoding</em> headers and still I always get UTF-8 JSON. But the client that needs the data is going to be included in a latin-1 web page, which is quite... you know. I can't influence that. I'd like to avoid re-encoding that all manually in JavaScript. In addition the serverside solution seems much more solid to me.</p> <p>I also tried some other stuff which I was never really expecting to work, like changing response character encoding with a servlet filter and so on. (Necessity is the mother of invention. ^^)</p> <p>Google/the web don't have much to offer on this topic so after hours of trying I now come here and hope somebody might tell me how this is intended to work or if it's even possible.</p> <p>So long, regards</p> <p>S.Frank</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload