Markus Schönhaber wrote:
> Works fine for me.
Well, that is really a surprise for me. I tried this in 3 different operating systems and it was consequently wrong.

> You do call response#setContentType before response#getWriter, don't you?
> There's no filter changing things?
Well, the code is more or less trivial: the class extends HttpServlet and overwrites method doGet like this:

@Override
    protected void doGet( HttpServletRequest request,
                          HttpServletResponse response )
        throws ServletException, IOException
    {
        response.setContentType( "text/html;charset=UTF-8" );
        response.setCharacterEncoding( "utf-8" );

        ServletOutputStream out = response.getOutputStream();
        out.println( "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0" +
             " Strict//EN\" \"http://www.w3.org/TR/xhtml1"; +
             "/DTD/xhtml1-strict.dtd\">" );
        out.println( "<html><head>" );
        out.println( "<meta http-equiv=\"Content-Type\" " +
                         "content=\"text/html; charset=utf-8\" />" );
        out.println( "</head>" );
        out.println( "<body>" );
        out.println( "<p>Just an encoding test: ä ö ü Ä Ö Ü ß</p>" );
        out.println( "</body>" );
        out.println( "</html>" );
    }

That's all.

> BTW: I consider LiveHTTPHeaders an incredibly useful Firefox extension
> when it comes to finding out which headers the server really sends.>
Thanks for the hint, I just installed it. Nevertheless in this case the HTTP header must be innocent: Firefox is using encoding UTF-8 to show the page, which is absolutely correct. The problem is simply the fact, that the characters are encoded as ISO-8859-1 (probably by the response output stream).

Best regards,
        hk

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to