On Sunday, September 07, 2003 8:47 AM, Remy Maucherat [SMTP:[EMAIL PROTECTED] 
wrote:
> Remy Maucherat wrote:
>
> I've just committed a very simple implementation of this (without the
> extra queryStringEncoding field, although this is not hard to add).
> Comments ?
>
> Remy

Thanks for your help with this. I have run through a simple UTF-8 test case and 
the problem as reported in bug 22666 is still present. I have tracked down what 
I believe to be the root cause to another part of the Parameters class. I have 
developed a patch for TC-5 below. I also think that the re-written try block in 
your patch for the Parameters class can be reverted as it doesn't appear to 
have any affect for UTF-8 query parameters.

Mark

PS I am off on holiday for a few days. I there is any further work remaining on 
this, I will do it on my return.

Index: catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-catalina/catalina/src/share/org/apa  
che/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     7 Sep 2003 
14:10:33 -0000
@@ -2316,7 +2316,7 @@
                     formData = new byte[len];
                 }
                 readPostBody(formData, len);
-                parameters.processParameters(formData, 0, len);
+                parameters.processParameters(formData, 0, len, false);
             } catch (Throwable t) {
                 ; // Ignore
             }


Index: util/java/org/apache/tomcat/util/http/Parameters.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/h  
ttp/Parameters.java,v
retrieving revision 1.11
diff -u -r1.11 Parameters.java
--- util/java/org/apache/tomcat/util/http/Parameters.java       7 Sep 2003 07:37:12 
-0000   1.11
+++ util/java/org/apache/tomcat/util/http/Parameters.java       7 Sep 2003 14:11:43 
-0000
@@ -392,7 +392,7 @@
     CharChunk tmpNameC=new CharChunk(1024);
     CharChunk tmpValueC=new CharChunk(1024);

-    public void processParameters( byte bytes[], int start, int len ) {
+    public void processParameters( byte bytes[], int start, int len, boolean 
query ) {
        int end=start+len;
        int pos=start;
        
@@ -434,8 +434,14 @@
            }
            tmpName.setBytes( bytes, nameStart, nameEnd-nameStart );
            tmpValue.setBytes( bytes, valStart, valEnd-valStart );
-           tmpName.setEncoding( encoding );
-           tmpValue.setEncoding( encoding );
+
+         if (query) {
+             tmpName.setEncoding( queryStringEncoding );
+             tmpValue.setEncoding( queryStringEncoding );
+         } else {
+             tmpName.setEncoding( encoding );
+             tmpValue.setEncoding( encoding );
+         }
        
            try {
                if( debug > 0 )
@@ -533,13 +539,13 @@
        if( data.getType() == MessageBytes.T_BYTES ) {
            ByteChunk bc=data.getByteChunk();
            processParameters( bc.getBytes(), bc.getOffset(),
-                              bc.getLength());
+                        bc.getLength(), true);
        } else {
            if (data.getType()!= MessageBytes.T_CHARS )
                data.toChars();
            CharChunk cc=data.getCharChunk();
            processParameters( cc.getChars(), cc.getOffset(),
-                              cc.getLength());
+                        cc.getLength() );
        }
     }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to