tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shankar Unni <>
Subject Re: Tomcat URL decoding different from Java's URLDecoder?
Date Wed, 06 Jun 2007 19:47:30 GMT
Christopher Schultz wrote:

> Shouldn't you use the content-type of the request instead of just
> forcing your own content-type? If the browser does not send a MIME type
> with the request, then the default is defined to be ISO-8859-1:

Well, for a form post, that just means that the text of the body is 
ISO8859-1 (which it is - it's all %blah-encoded strings). It's how to 
actually decode those strings (using a URL decoder) that matter.

In our case, do notice that I'm *not* calling URLDecode in Tomcat 
itself. Tomcat is just running a (poorly-written, deliberately) webapp, 
and we're sniffing that traffic and doing all the decoding in an 
external system.

So Tomcat is running with -Dfile.charset=Big5 (so that's the java 
default charset), and just does a 'request.getParameter("foo")'. And the 
value for foo in the body of the POST is "%AEx", which (again) we didn't 
encode - it's IE that's doing this when you type in a Big5 char into a 
text field in a form (I guess it's internally treating the raw bytes as 

Yet, in the JSP, when I do a request.getParameter("foo"), I magically 
end up with the correct Big5 character in a String. That seemed like magic.

Thanks for the hits about PARAMETER_ENCODING, etc. in web.xml (though I 
don't see how that can influence IE to encode things correctly in the 
simple form POST).

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message