You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by roy tang <ro...@gmail.com> on 2006/04/10 05:14:32 UTC

Help with filter affecting Chinese words in request parameters

Hi,

I'm new to this list, hope someone here can help. :)

We're developing a webapp that should be able to accept Chinese input. We
also have a filter installed in the webapp for some auditing that we need to
do per request that's processed. However, we've found that when we submit a
form with Chinese inputs, the Chinese chars end up saved to the database as
HTML-escaped entities. (i.e. &#32610; or such).

So we backtrace, and we find that removing the filter from web.xml fixes the
problem. We debug through the doFilter() method of our filter, but we find
that at the start of the method, request.getParameter("PARAM_NAME") already
shows the input as HTML-escaped entities.

The weird thing is, this doesn't happen on all our Tomcat
installations...each of our developers has a local Tomcat running, and it
only happens for one or two. But it also happens on our Test (QA) server,
such that our testing team always encounters the problem.

Is there any particular language or encoding setting that I should be
checking?

Thanks a lot :D

Roy

Re: Help with filter affecting Chinese words in request parameters

Posted by Mark Hagger <ma...@m-spatial.com>.
Hi,

This may not be relevant here, but one standard "gotcha" that keeps
hitting me is a difference in the platforms default encoding.  Ie some
machines have a default of ISO-88591, some CP1252, and some UTF-8.  The
JVM then just merrily does stuff using the default encoding, and thus
developers get a working system and the production systems don't...

In some ways its better to have developers all working with different
defaults, so at least issues like this get caught early.

A thought anyway.

Mark


On Sun, 2006-04-09 at 22:53 -0500, Mike Sabroff wrote:
> So, what are the differences on the machines that have the problem vs 
> the ones that don not??
> 
> roy tang wrote:
> > Hi,
> >
> > I'm new to this list, hope someone here can help. :)
> >
> > We're developing a webapp that should be able to accept Chinese input. We
> > also have a filter installed in the webapp for some auditing that we need to
> > do per request that's processed. However, we've found that when we submit a
> > form with Chinese inputs, the Chinese chars end up saved to the database as
> > HTML-escaped entities. (i.e. &#32610; or such).
> >
> > So we backtrace, and we find that removing the filter from web.xml fixes the
> > problem. We debug through the doFilter() method of our filter, but we find
> > that at the start of the method, request.getParameter("PARAM_NAME") already
> > shows the input as HTML-escaped entities.
> >
> > The weird thing is, this doesn't happen on all our Tomcat
> > installations...each of our developers has a local Tomcat running, and it
> > only happens for one or two. But it also happens on our Test (QA) server,
> > such that our testing team always encounters the problem.
> >
> > Is there any particular language or encoding setting that I should be
> > checking?
> >
> > Thanks a lot :D
> >
> > Roy
> >   
> 


________________________________________________________________________
This email has been scanned for all known viruses by the MessageLabs SkyScan service.

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


Re: Help with filter affecting Chinese words in request parameters

Posted by Mike Sabroff <mi...@cygnusb2b.com>.
So, what are the differences on the machines that have the problem vs 
the ones that don not??

roy tang wrote:
> Hi,
>
> I'm new to this list, hope someone here can help. :)
>
> We're developing a webapp that should be able to accept Chinese input. We
> also have a filter installed in the webapp for some auditing that we need to
> do per request that's processed. However, we've found that when we submit a
> form with Chinese inputs, the Chinese chars end up saved to the database as
> HTML-escaped entities. (i.e. &#32610; or such).
>
> So we backtrace, and we find that removing the filter from web.xml fixes the
> problem. We debug through the doFilter() method of our filter, but we find
> that at the start of the method, request.getParameter("PARAM_NAME") already
> shows the input as HTML-escaped entities.
>
> The weird thing is, this doesn't happen on all our Tomcat
> installations...each of our developers has a local Tomcat running, and it
> only happens for one or two. But it also happens on our Test (QA) server,
> such that our testing team always encounters the problem.
>
> Is there any particular language or encoding setting that I should be
> checking?
>
> Thanks a lot :D
>
> Roy
>   

-- 
Mike Sabroff
Web Services Developer
mike.sabroff@cygnusb2b.com
920-568-8379


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


Re: Help with filter affecting Chinese words in request parameters

Posted by roy tang <ro...@gmail.com>.
Thanks to everyone who replied.

One of the devs found a workaround...we set the filter to set the encoding
of both the request and the response (previously we only tried setting one
or the other...apparently both have to be set correctly)

Regards,

Roy

On 4/10/06, roy tang <ro...@gmail.com> wrote:
>
> Hi,
>
> I'm new to this list, hope someone here can help. :)
>
> We're developing a webapp that should be able to accept Chinese input. We
> also have a filter installed in the webapp for some auditing that we need to
> do per request that's processed. However, we've found that when we submit a
> form with Chinese inputs, the Chinese chars end up saved to the database as
> HTML-escaped entities. ( i.e. &#32610; or such).
>
> So we backtrace, and we find that removing the filter from web.xml fixes
> the problem. We debug through the doFilter() method of our filter, but we
> find that at the start of the method, request.getParameter ("PARAM_NAME")
> already shows the input as HTML-escaped entities.
>
> The weird thing is, this doesn't happen on all our Tomcat
> installations...each of our developers has a local Tomcat running, and it
> only happens for one or two. But it also happens on our Test (QA) server,
> such that our testing team always encounters the problem.
>
> Is there any particular language or encoding setting that I should be
> checking?
>
> Thanks a lot :D
>
> Roy
>



--
Roy Tang for President in 2022
http://roytang.net/blog

Re: Help with filter affecting Chinese words in request parameters

Posted by Kurt Overberg <ku...@hotdogrecords.com>.
I'm running using Unicode for international characters, and I have 
-Dfile.encoding=UTF-8 set on my VMs.  Also, at the top of all my JSP 
pages, I have:

<%@ page language="java" pageEncoding="UTF-8"%>

...we may also have a Filter set up to something in the chain, but I 
can't check that right now.  Hope this helps...

/kurt



roy tang wrote:
> Hi,
> 
> I'm new to this list, hope someone here can help. :)
> 
> We're developing a webapp that should be able to accept Chinese input. We
> also have a filter installed in the webapp for some auditing that we need to
> do per request that's processed. However, we've found that when we submit a
> form with Chinese inputs, the Chinese chars end up saved to the database as
> HTML-escaped entities. (i.e. &#32610; or such).
> 
> So we backtrace, and we find that removing the filter from web.xml fixes the
> problem. We debug through the doFilter() method of our filter, but we find
> that at the start of the method, request.getParameter("PARAM_NAME") already
> shows the input as HTML-escaped entities.
> 
> The weird thing is, this doesn't happen on all our Tomcat
> installations...each of our developers has a local Tomcat running, and it
> only happens for one or two. But it also happens on our Test (QA) server,
> such that our testing team always encounters the problem.
> 
> Is there any particular language or encoding setting that I should be
> checking?
> 
> Thanks a lot :D
> 
> Roy

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