tomcat-users mailing list archives

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

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)
http://old.nabble.com/DefaultServlet-doesn%27t-set-charset-td18893115.html#a18929527

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.

Bye
 Felix

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message