package org.apache.jmeter.protocol.http.util;

import java.net.URLEncoder;

import org.apache.oro.util.Cache;
import org.apache.oro.util.CacheLRU;

/**
 * @author Administrator
 *
 * To change this generated comment edit the template variable "typecomment":
 * Window>Preferences>Java>Templates.
 */
public class EncoderCache
{
    Cache cache;

    public EncoderCache(int cacheSize)
    {
       cache = new CacheLRU(cacheSize);
    }
    
    public String getEncoded(String k)
    {
        Object encodedValue = cache.getElement(k);
        if(encodedValue != null)
        {
            return (String)encodedValue;
        }
        encodedValue = URLEncoder.encode(k);
        cache.addElement(k,encodedValue);
        return (String)encodedValue;
    }
    
    

}

@@ -40,16 +40,61 @@
 .util;%0A%0A
+import java.io.UnsupportedEncodingException;%0A
 import j
@@ -666,24 +666,50 @@
 ;%0A        %7D%0A
+        try%0A        %7B%0A    
         enco
@@ -738,18 +738,246 @@
 encode(k
-);
+, %22utf8%22);%0A        %7D%0A        catch (UnsupportedEncodingException e)%0A        %7B%0A            // This can't happen (how should utf8 not be supported!?!),%0A            // so just throw an Error:%0A            throw new Error(e);%0A        %7D
 %0A       
@@ -1052,23 +1052,12 @@
 ue;%0A
+
     %7D%0A
-    %0A    %0A%0A
 %7D%0A

Use utf8 to encode URLs.