You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2016/06/27 17:11:01 UTC

[Bug 59764] New: Character encoding is wrong for requests which mix GET and POST parameters

https://bz.apache.org/bugzilla/show_bug.cgi?id=59764

            Bug ID: 59764
           Summary: Character encoding is wrong for requests which mix GET
                    and POST parameters
           Product: Tomcat 8
           Version: 8.0.30
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Connectors
          Assignee: dev@tomcat.apache.org
          Reporter: tofarr@gmail.com

Created attachment 33992
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33992&action=edit
Small sample application demonstrating this bug

I attached a small sample to demonstrate this bug.

I have a tomcat servlet container with a connector defined to use UTF-8 as the
default character encoding:

<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="120000"
redirectPort="8443" URIEncoding="UTF-8" compression="on"
compressableMimeType="text/html,text/xml,text/plain,text/javascript,text/css,text/json,application/json,application/javascript"
compressionMinSize="2048"/>

For requests which contain both URL and form paramters, e.g.:

Request URL:
http://localhost:8084/EncodingBug/EchoParamsServlet?getParam=All%20the%20way%20to%20San%20Jos%C3%A9!
Request Method:POST
Form Data: postParam=All+the+way+to+San+Jos%C3%A9!

Post parameters are not parsed using UTF-8 encoding even though this is
specified in the request and in the server.xml, so non English characters
become garbled. (e.g.: "All the way to San José!" -> "All the way to San
José!")

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 59764] Character encoding is wrong for requests which mix GET and POST parameters

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59764

--- Comment #3 from zhenek <vr...@gmail.com> ---
I have tested with tomcat 7.0.70 and tomcat 9 M8
the results are same

and I have uncommented setCharacterEncodingFilter  filter definition using
8.0.30 no luck

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 59764] Character encoding is wrong for requests which mix GET and POST parameters

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59764

--- Comment #2 from zhenek <vr...@gmail.com> ---

My env is
ubuntu linux with locales set this way:

LC_PAPER=en_US.UTF-8
LC_ADDRESS=cs_CZ.UTF-8
LC_MONETARY=en_US.UTF-8
LC_NUMERIC=en_US.UTF-8
LC_TELEPHONE=cs_CZ.UTF-8
LC_IDENTIFICATION=cs_CZ.UTF-8
LANG=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_NAME=cs_CZ.UTF-8

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 59764] Character encoding is wrong for requests which mix GET and POST parameters

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59764

zhenek <vr...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vrablik@gmail.com
                 OS|                            |All

--- Comment #1 from zhenek <vr...@gmail.com> ---
Hi,

I have tested with tomcat 8.0.30 the attached war using these curl requests

curl -i -X POST -d postParam=All+the+way+to+San+Jos%C3%A9! 
http://localhost:8080/EncodingBug/EchoParamsServlet?getParam=All%20the%20way%20to%20San%20Jos%C3%A9

the response is not correct

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/plain;charset=UTF-8
Content-Length: 74
Date: Tue, 28 Jun 2016 08:09:36 GMT

getParam: All the way to San José
postParam: All the way to San José!


Same request but with charset specified returns null instead of the invalid
string

curl -i -X POST -H "Content-Type: text/html; charset=UTF-8" -d
postParam=All+the+way+to+San+Jos%C3%A9! 
http://localhost:8080/EncodingBug/EchoParamsServlet?getParam=All%20the%20way%20to%20San%20Jos%C3%A9

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/plain;charset=UTF-8
Content-Length: 51
Date: Tue, 28 Jun 2016 08:16:17 GMT

getParam: All the way to San José
postParam: null

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 59764] Character encoding is wrong for requests which mix GET and POST parameters

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59764

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
There is no bug here.

Please read this:
http://wiki.apache.org/tomcat/FAQ/CharacterEncoding

and if you still have questions please use the Tomcat users' mailing list.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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