You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by James Dennett <ja...@sessami.com> on 2000/06/07 00:33:32 UTC
Content-type headers with ";charset=UTF-8" confusing Tomcat?
Hello all,
I have a question regarding what appears to be a bug in Tomcat.
Using Tomcat 3.0 or 3.1, it seems that HTTP POST requests with a Content-type header
such as
Content-type: application/x-www-form-urlencoded;charset=UTF-8
which are being sent by some real-world applications.
It's not the UTF-8 which is stopping this working; it also fails with
Content-type: application/x-www-form-urlencoded;charset=8859_1
which is the same charset specification which is sent back by Tomcat 3.1 itself.
The symptom is that getParameter returns null for all of the form parameters. I've not tracked down the cause yet.
Removing the ";charset=UTF-8" from the submitted header makes the parameter values (which are all in the US-ASCII subset of UTF-8) be returned correctly from getParameter.
I can see in RequestUtil.java that HttpUtils.parsePostData is called to parse the posted form data, but is not given information about the charset, so it [parsePostData] assumed "8859-1". That would be pretty bad, but wouldn't explain the failure to work
with US-ASCII data, which would parse the same whether the charset was ISO-8859-1 or UTF-8.
Does anyone have any further information on the failure of Tomcat to tolerate ";charset" on Content-Type headers?
Thanks in advance,
James Dennett.