tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Schumacher <>
Subject DefaultServlet and default character encoding
Date Thu, 17 Jun 2010 14:23:11 GMT

I have a character encoding problem with the DefaultServlet. 

We use it to serve static html content, which is encoded in utf-8.
The DefaultServlet doesn't set characterset in the response, so the
browser looks for a meta-tag describing the encoding. Luckily these are set
in our content and the content is displayed correctly. So no problem...

...but if we have the same application behind an apache httpd-server
connected with mod_jk, apache httpd thinks it would be better to append a
charset to the response. In our case it takes a guess ( I guess ) and
appends iso-8859-1 to the content-type header. Which in turn renders the
meta-tag inside of the html useless and results in a wrong encoding/display
in the browser.

I have found an old discussion on this list where this problem was
discussed (without the mod_jk part)

My Question now is, should I file a bug to enhance DefaultServlet? If so
would it be legal to include the patch from that discussion?

For the moment I have written a filter, which sets a default encoding, as
soon as Response.setContentType(String type) is called and
type.startsWith("text/"). That works for the moment, but I would prefer the
solution described in above thread.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message