DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14404>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14404 MultipartIterator does not reflect ServletRequest#setCharacterEncoding ------- Additional Comments From [EMAIL PROTECTED] 2002-11-09 03:45 ------- following patch will fix the problem. --- 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 @@ } } + + + + + + + + + + -- To unsubscribe, e-mail: <mailto:struts-dev-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-dev-help@;jakarta.apache.org>
