users@jersey.java.net

Issue with German Umlauts in output

From: Stefan Zoerner <szoerner_at_apache.org>
Date: Fri, 01 May 2009 21:53:00 +0200

Hi all,

I have a problem with Jersey, if the content provided by my REST service
contains German Umlauts (äöüÄÜÖß).

I have isolated the problem to a simple Hello like this:

package hello;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

@Path("/helloworld")
public class HelloWorldResource {

        @GET
        @Produces("text/plain")
        public String sayHello() {
                return "Hallo Stefan Zörner\n";
        }

        @GET
        @Produces("text/html")
        public String sayHelloInHtml() {
                return "<html><title>Hallo</title><body><h2>Hallo Stefan
Zörner</h2></body></html>";
        }
}


If I consume this resource, the German Umlaut O (with dots on top of
it), does not appear correctly on the client side. It does not matter,
whether I use Grizzly, Tomcat with Spring etc., or if the contents comes
from a database instead of the source code. Umlauts are wrong.


I assume, there is an encoding problem, but I have no idea, where to
configure that ...

Here are some infos about my environment:

Windows XP SP 2
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
jersey-bundle-1.0.1.jar

Problem occurs with Jersey 1.0.2 as well, btw.


Any help is highly appreciated.
Greetings from Hamburg,
     Stefan