tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Boris Folgmann <m...@folgmann.com>
Subject Re: UTF-8 end to end - what am I doing wrong?
Date Fri, 11 Apr 2003 18:50:45 GMT
Hi Derrick!

Koes, Derrick schrieb:
> You could also use a filter.

I've done the opposite, I've written a filter to dynamically translate all
charactes of the response to UTF-8, if the client supports it. This was
needed because some clients of my application only understand UTF-8 and not
ISO-8859-1, which is the tomcat default. Here's my code:

String acceptCharset = request.getHeader("Accept-Charset");
if (  null != acceptCharset
    &&  -1 != acceptCharset.toUpperCase().indexOf("UTF-8"))
{
    response.setContentType("text/html; charset=UTF-8"); // apply only to
web pages!!
}
chain.doFilter(request, response); // process desired web page

But my big problem is, that this solution only works with tomcat 4.0.4
(which is part of my IDE NetBeans 3.4.1) but not with the standalone tomcat
 4.1.18. While all characters are perfectly UTF-8 encoded with 4.0.4, the
latest tomcat seems to more or less ignore my setContentType(), because
it's still ISO-8859-1, which I also get when do a getContentyType() in one
of my JSPs.

Do you have any idea what could be the problem?

cu,
	boris

-- 
Dipl.-Inf. Boris Folgmann   mailto:boris@folgmann.de
Folgmann IT-Consulting      http://www.folgmann.de


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


Mime
View raw message