2011/12/6 Christopher Schultz <ch...@christopherschultz.net>: > On 12/4/11 8:02 PM, Konstantin Kolinko wrote: >> Make sure that content type and charset value in a) Content-Type >> HTTP header sent by server and b) in META tag in HTML text have >> _literally_ the same value. If they both are present and they do >> not match, odd things may happen in "non-compliant" browsers. > > I almost always do the following at the top of my pages (JSP shows, > but you get the idea for any templating system): > > <html> > <head> > <meta http-equiv="Content-Type" > content="text/html<% null == response.getCharacterEncoding() > ? "" > : ";" + response.getCharacterEncoding() %>" > /> > > I do this so that, in case the response encoding gets changed from > whatever I think it is, I don't report the wrong one. You don't want > the page to say UTF-8 when the encoding is really SHIFT-JS or > something else. >
:) I always do similar, but a bit more simple implementation of the above: <%= response.getContentType() %> 2011/12/6 Christopher Schultz <ch...@christopherschultz.net>: > On 12/5/11 6:53 PM, Konstantin Kolinko wrote: >> Note, that there is standard "SetCharacterEncodingFilter" in Tomcat >> 7. (In 7.0 it is in o.a.c.filters package, in 6.0 and 5.5 it is >> examples webapp). > > I see that you've moved that out of examples and into the main code base. > > Should we also provide a Valve version of this? That way, you can make > sure that the encoding is set before Valves like the > AuthenticatorValve fire. > 1. I do not use valves that call getParameter(), so I have not seen the need, but the FormAuthenticator will need the feature? Anyone who have an itch can implement the valve. 2. I sometimes wonder whether URIEncoding setting on a Connector can be moved to a Context instead. 3. Maybe backport the move of SetCharacterEncodingFilter to 6.0. Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org