tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anto Paul <antop...@gmail.com>
Subject Re: Character encoding question
Date Mon, 29 Aug 2005 10:41:33 GMT
The setCharacterEncoding() must be called on the request before any
getParameter() method is invoked on it. There may be some filters that
is processing the request in the filter chain before the setCharacter
encoding filter.

Also what is the character encoding used by the OS ?. 
URIEncoding method is useful with GET methods since the parameters are
sent along with the URL. Try using POST methods everywhere and check
for problems. To be safe I am using hidden variables and sending data
as POST instead of appending it to the URL.


On 8/29/05, Richard Jones <richard.jones@ub.uib.no> wrote:
> Hi,
> 
> > > I am having problems with Scandinavian characters on my system and am
> > > attempting to isolate the problem; any help would be greatly
> > > appreciated.
> >
> > This is what I did to work with Tomcat.
> >
> > a, Set up Tomcat first: To support UTF encoded data send as part of
> > URI one has to set the URIEncoding attribute of the coyote Connector
> > element in server.xml.
> > b, Use a filter to set the character encoding of the request before it
> > is processed.
> > public void doFilter(ServletRequest req,ServletResponse res,FilterChain chain) {
> > request.setCharacterEncoding("UTF-8");
> > chain.doFilter(req,res);
> > }
> > c, Set the following header in all JSP pages.
> > <%@ page contentType="text/html; charset=UTF-8"%>
> 
> I have delved into the source code, and after a minor fiddle with the
> tomcat server.xml to ensure that URIEncoding is set correctly I am
> certain that these three requirements are currently fulfilled, and were
> so before.  I have disabled RequestDumperValve after reading something
> about issues it causes with setCharacterEncoding, and instead am relying
> on our own log4j debug output.
> 
> Annoyingly (or not, depending on how you look at it), I am having
> trouble reproducing the problem again!  Perhaps I had fixed it with the
> URIEncoding setting, only not noticed because I still had
> RequestDumperValve enabled.
> 
> This problem has been strangely elusive; sometimes I have problems and
> other times not, both within the same system and across other versions.
> I'll keep an eye on it, and see if there's any more information I can
> get out of it.  I may be back later today ;)
> 
> Thanks all for your help,
> 
> Best Wishes,
> 
> --
> Richard
> -------
> Richard Jones                    |
> Overingeniør                     | Senior Engineer
> Universitetsbiblioteket i Bergen | University of Bergen Library
> 
> e: richard.jones@ub.uib.no
> t: +47 55 58 25 37
> 
> BORA: http://bora.uib.no/
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 


-- 
rgds
Anto Paul

---------------------------------------------------------------------
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