Hello therer tomcat users ;)
I'm not sure if this is a bug, so I'm posting a description of an unusual
problem, and hope that if this is not a bug, somebody will prove that I'm
missing something here...
I have JSP page that has static content (outside <% %> tags) in ISO-8859-2,
and a few static html pages. When it's completelly up to Tomcat to generate
some page (for example redirect request, or internal server error) - it
outputs Content-Type: header corectly (whole Linux enviroment is set to
pl_PL) like this:
Content-Type: text/html;charset=ISO-8859-2
When it sends static html, it outputs:
Content-Type: text/html
..but this is corrected by <META http-equiv ...> tag. However *EVERYTIME*
tomcat is sending back output of a JSP page, it is sending this:
Content-Type: text/html;charset=ISO-8859-1
which is ok (as defined in JSP spec), but there's *NO* way to change it!
I've tried nearly everything, including:
<% response.setHeader("Content-Type", "text/html;charset=ISO-8859-2"); %>
or
<%@ page contentType("text/html;charset=ISO-8859-2"); %>
All those tags make response.setHeader(...) apear on top of __jspService
(inside proper .java file in $TOMCAT_HOME/work), but then... header get's
overwritten by tomcat to ISO-8859-1 which scrambles all content and forces
user to pick up ISO-8859-2 from browsers encoding menus everytime document
is generated, which is really annoying. Bowsers seems to ignore <META
http-equiv ...> tag in favour of server generated Content-Type: header.
Thanks to tomcat beeing opensource, I can just play with
share/org/apache/jasper/compilser/Compiler.java, and broke spec by setting
default encoding to ISO-8859-2, but I feel like that's not the way...
Is it a bug in jasper, or am I missing something here?
--
Jacek Prucia
7bulls.com S.A.