You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Mark Thomas <me...@ntlworld.com> on 2003/09/05 20:39:34 UTC

[PATCH] Bug 22666

URIs are always UTF-8 encoded. Therefore the parameter encoding should be set 
to UTF-8 and not to the request encoding (if set). Patches for TC5 and TC4 are 
below.

Mark


Index: catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote  
/tomcat5/CoyoteRequest.java,v
retrieving revision 1.15
diff -u -r1.15 CoyoteRequest.java
--- catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java	31 Aug 2003 
21:08:56 -0000	1.15
+++ catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java	5 Sep 2003 
18:34:50 -0000
@@ -2275,14 +2275,8 @@

         Parameters parameters = coyoteRequest.getParameters();

-        String enc = coyoteRequest.getCharacterEncoding();
-        if (enc != null) {
-            parameters.setEncoding(enc);
-        } else {
-            parameters.setEncoding
-                (org.apache.coyote.Constants.DEFAULT_CHARACTER_ENCODING);
-        }
-
+        parameters.setEncoding("UTF-8");
+
         parameters.handleQueryParameters();

         if (usingInputStream || usingReader)



Index: coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/  
tomcat4/CoyoteRequest.java,v
retrieving revision 1.29
diff -u -r1.29 CoyoteRequest.java
--- coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java	5 Apr 2003 
08:18:04 -0000	1.29
+++ coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java	5 Sep 2003 
18:36:54 -0000
@@ -1922,13 +1922,7 @@

         Parameters parameters = coyoteRequest.getParameters();

-        String enc = coyoteRequest.getCharacterEncoding();
-        if (enc != null) {
-            parameters.setEncoding(enc);
-        } else {
-            parameters.setEncoding
-                (org.apache.coyote.Constants.DEFAULT_CHARACTER_ENCODING);
-        }
+        parameters.setEncoding("UTF-8");

         parameters.handleQueryParameters();
 

Re: [PATCH] Bug 22666

Posted by Remy Maucherat <re...@apache.org>.
Mark Thomas wrote:

> URIs are always UTF-8 encoded. Therefore the parameter encoding should be set 
> to UTF-8 and not to the request encoding (if set). Patches for TC5 and TC4 are 
> below.

?
This is incorrect, strong -1 for this patch.

Remy