--- MultipartIterator.java.orig	Wed Nov 06 22:07:00 2002
+++ MultipartIterator.java	Wed Nov 06 22:05:50 2002
@@ -227,12 +227,17 @@
                 //for text
                 StringBuffer textData = new StringBuffer();
                 String line;
+		String enc;
+		enc = request.getCharacterEncoding();
+		if(enc == null) 
+		    enc = "ISO-8859-1";
+
                 //parse for text data
-                line = readLine();
+                line = readLine(enc);
 
                 while ((line != null) && (!line.startsWith(boundary))) {
                     textData.append(line);
-                    line = readLine();
+                    line = readLine(enc);
                 }
 
                 if (textData.length() > 0) {
@@ -447,9 +452,9 @@
     }
 
     /**
-     * Reads the input stream until it reaches a new line
+     * Reads the input stream until it reaches a new line using encoding.
      */
-    protected String readLine() throws ServletException, UnsupportedEncodingException {
+    protected String readLine(String enc) throws ServletException, UnsupportedEncodingException {
 
         byte[] bufferByte;
         int bytesRead;
@@ -473,10 +478,18 @@
         }
 
         totalLength += bytesRead;
-        return new String(bufferByte, 0, bytesRead, "ISO-8859-1");
+        return new String(bufferByte, 0, bytesRead, enc);
     }
 
     /**
+     * Reads the input stream until it reaches a new line assuming ISO-8859-1 encoding
+     */
+    protected String readLine() throws ServletException, UnsupportedEncodingException {
+	return this.readLine("ISO-8859-1");
+    }
+
+
+    /**
      * Creates a file on disk from the current mulitpart element
      * @param fileName the name of the multipart file
      */
@@ -559,3 +572,13 @@
    }
 
 }
+
+
+
+
+
+
+
+
+
+
