--- xml-cocoon2.org/src/org/apache/cocoon/generation/RequestGenerator.java	Mon Dec  3 14:34:28 2001
+++ xml-cocoon2/src/org/apache/cocoon/generation/RequestGenerator.java	Mon Dec  3 15:08:16 2001
@@ -8,13 +8,18 @@
 package org.apache.cocoon.generation;
 
 import org.apache.avalon.excalibur.pool.Recyclable;
+import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.cocoon.Constants;
+import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.SourceResolver;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.AttributesImpl;
 
+import java.io.IOException;
 import java.util.Enumeration;
 import java.util.Iterator;
+import java.util.Map;
 
 /**
  *
@@ -27,6 +32,16 @@
 
     /** The URI of the namespace of this generator. */
     private String URI="http://xml.apache.org/cocoon/requestgenerator/2.0";
+    private String container_encoding;
+    private String form_encoding;
+
+    public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
+        throws ProcessingException, SAXException, IOException {
+        super.setup(resolver, objectModel, src, par);
+
+        container_encoding = par.getParameter("container-encoding", "ISO-8859-1");
+        form_encoding = par.getParameter("form-encoding", null);
+    }
 
     /**
      * Generate XML data.
@@ -77,7 +92,18 @@
             if (values!=null) for (int x=0; x<values.length; x++) {
                 this.data("      ");
                 this.start("value",attr);
-                this.data(values[x]);
+                if (form_encoding != null) {
+					try {
+						this.data(new String(values[x].getBytes(container_encoding),
+							form_encoding));
+					} catch(java.io.UnsupportedEncodingException uee) {
+						throw new RuntimeException("Unsupported Encoding Exception: " +
+						    uee.getMessage());
+					}
+				}
+				else {
+                    this.data(values[x]);
+				}
                 this.end("value");
                 this.data("\n");
             }

