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 2008/10/06 21:27:32 UTC

DO NOT REPLY [Bug 45957] New: UTF-8 POST request results in corrupted data

https://issues.apache.org/bugzilla/show_bug.cgi?id=45957

           Summary: UTF-8 POST request results in corrupted data
           Product: Tomcat 5
           Version: 5.5.27
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Connector:HTTP
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: andrejohn.mas@gmail.com


Currently in Tomcat 5 if a request is received containing UTF-8 content then
any accents or non-Roman characters are corrupted, since there is an assumption
the POST request is ISO-8895-1 (latin1). For example 'é' becomes 'é'. A
work around is specified on the following page:

   http://wiki.apache.org/tomcat/Tomcat/UTF-8

in the form of a Filter class, called 'CharsetFilter'. IMHO, this is not the
most ideal solution for a site that is wanting to standardise on UTF-8.

It should be noted that in the same document, referenced above, there is an
option to specify the encoding of the URI. It would be handy to have something
equivalent for the POST content, maybe something like "POSTencoding",
defaulting to ISO-8859-1 as is used currently, and then providing the necessary
code to use UTF-8 instead.

This issue is valid for both Tomcat 5 and 6.

additional keywords: internationalisation, internationalization, i18n


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 45957] POST request-body permits only ISO-8859-1

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


Will Rowe <wr...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|UTF-8 POST request results  |POST request-body permits
                   |in corrupted data           |only ISO-8859-1




--- Comment #1 from Will Rowe <wr...@apache.org>  2008-10-06 13:55:57 PST ---
Your subject choice was fuzzy.  We'll presume you mean the entity-body of POST
requests, since the POST request-URI itself can be toggled to another encoding.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 45957] POST request-body permits only ISO-8859-1

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





--- Comment #6 from Mark Thomas <ma...@apache.org>  2008-10-12 11:34:51 PST ---
This was discussed on the users list. See:
http://markmail.org/message/zozxd3iqp47ciisw


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 45957] POST request-body permits only ISO-8859-1

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





--- Comment #4 from André-John Mas <an...@gmail.com>  2008-10-06 17:56:06 PST ---
The problem I have with the suggested approach is that it treats UTF-8 as an
exception, rather that a norm for my whole application server. I am not sure
that I should be having to be specifying the encoding before handling every
request. For a web site that is completely in UTF-8 that is a lot of duplicated
code.

Also, I ask the question why should we allow one behaviour for the URI in the
container and not allow for the same with regards to the POST?

I don't see this ticket as invalid, given the above arguments.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 45957] POST request-body permits only ISO-8859-1

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


Mihály Héder <he...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hedermisi@gmail.com




--- Comment #5 from Mihály Héder <he...@gmail.com>  2008-10-12 10:26:09 PST ---
I absolutely agree with André-John.

This particular issue has been a real showstopper for years and is the most
seriuos argument against Tomcat for non english-only applications. It makes
everything much harder than it should be:

1. you develop something, and you see that the accented characters are broken.
After some googling you find the request.setCharacterEncoding("UTF-8")
solution. You insert it into your code. 

2. you troubleshoot by writing things out to stdout, and checking catalina.out
for results. You see that the encoding is still broken.

3. after painful hours you figure out that the request's encoding had been ok
since step 1, the problem is that _logging_ also has problems with encoding.
You lose some hair.

4. Things are ok with the requests but the UTF-8 responses are broken. Although
not mentioned in the wiki, you quickly find out that you should do 
response.setCharacterEncoding("UTF-8");
That wasn't a big deal.

5. You want to use stuff (frameworks, etc..) developed by else and you don't
want to modigy the code. I'ts time to use the filter solution you have found in
the wiki. You modify your web.xml, insert the class (modified so that is sets
up response character encoding as well) into your jar. You had to do an hour or
so extra work but things are ok.

6. You move your stuff into production environment where there is a Sun Access
Manager or similar in front of your app. Things are broken again. After a lot
of research you figure out that the problem is with the filter chain, and your
only hope is to modify the main conf/web.xml, put your filter there. You
convince the sysadmin that it won't hurt else's webapps, another hours of work.


Agreed, there is a hack to solve every issue listed here but WHY must this be
so painful? I think utf8 should be the default, or configurable at least...
I see people getting stuck with this every now and then and they asking about
configuration options not code.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 45957] POST request-body permits only ISO-8859-1

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





--- Comment #2 from André-John Mas <an...@gmail.com>  2008-10-06 14:20:44 PST ---
Confirmed, I do mean the entity body, as URIencoding already exists for the
request-URI. Thanks.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 45957] POST request-body permits only ISO-8859-1

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


Will Rowe <wr...@apache.org> changed:

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




--- Comment #3 from Will Rowe <wr...@apache.org>  2008-10-06 16:45:59 PST ---
Before reading the POST body - you should first be doing this:
request.setCharacterEncoding("UTF-8") 

 - Tim Funk, as posted to dev@tomcat.a.o


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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