Hi Stefan,
If you specify the charset on the @Produces media type, does that work
for you?
I think there is a bug in Jersey. I previously thought that the client
should assume a charset of UTF-8 in the absence of a charset
parameter, but then i re-read:
http://greenbytes.de/tech/webdav/rfc2616.html#canonicalization.and.text.defaults
So Jersey should be including the charset parameter of "charset=utf-8"
if one is not already declared.
Could you log an issue?
Thanks,
Paul.
On May 1, 2009, at 11:11 PM, Stefan Zoerner wrote:
> Hi Marc,
>
> thanks for your immediate response.
>
> Marc Hadley wrote:
>> How are you viewing the output ? You should receive UTF-8 encoded
>> strings unless you override it. If you are using a browser you may
>> have to manually tell it to treat the page as UTF-8. You can also
>> specify this in the response like this:
>
> I have used different ones, none worked. Firefox, curl, a ServiceMix
> consumer ... But now it works quite well. Firefox now presents the
> responses including umlauts, after I followed you hint.
>
> This is how my sample code looks like now (just in case someone else
> has comparable problems):
>
> @GET
> @Produces("text/plain")
> public Response sayHello() {
> return Response.ok("Hallo Stefan Zörner\n", "text/plain;
> charset=ISO-8859-1").build();
> }
>
> @GET
> @Produces("text/html")
> public Response sayHelloInHtml() {
> return Response.ok("<html><title>Hallo</title><body><h2>Hallo
> Stefan Zörner</h2></body></html>", "text/html;
> charset=utf-8").build();
> }
>
>
> It works quite well. Only my curl still seems to have trouble with
> UTF-8; I have therefore modified the charset - now it works.
>
> Thanks again, I am quite happy.
>
> Greetings from Hamburg,
> Stefan
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>