You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2003/11/18 05:47:02 UTC
DO NOT REPLY [Bug 24765] New: -
The current code assumes the platforms default encoding is iso-8859-1
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=24765>.
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=24765
The current code assumes the platforms default encoding is iso-8859-1
Summary: The current code assumes the platforms default encoding
is iso-8859-1
Product: Commons
Version: 1.0 Final
Platform: Other
OS/Version: OS/400
Status: NEW
Severity: Major
Priority: Other
Component: File Upload
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: miller_daniel_c@cat.com
Currently the jakarta commons File Upload assumes that the default platform
character encoding is iso-8859-1(or some variant), which is not always the case
causing it to operate incorrectly. Below I have identified all classes that do
not support multiple types of encoding. I have put together a solution below
that points out the majority of areas that require the encoding to be
specified. I realize that this is not the most efficient code, but I leave
that up to you to implement it the best way. Please let me know if this is an
acceptable solution and when a new release could be made.
Class org.apache.commons.fileupload.FileUpload
----------------------------------------------
Line 331:
byte[] boundary = contentType.substring(contentType.indexOf("boundary=") +
9).getBytes();
//Make sure the bytes match the servlets inputStream bytes
>byte[] boundary = contentType.substring(contentType.indexOf("boundary=") +
9).getBytes(req.getCharacterEncoding());
Class org.apache.commons.fileupload.MultipartStream
---------------------------------------------
Line 282
this.boundary[0] = 0x0D;
this.boundary[1] = 0x0A;
this.boundary[2] = 0x2D;
this.boundary[3] = 0x2D;
>this.boundary[0] = new String(new byte[]{Character.LINE_SEPARATOR}, "iso-8859-
1").getBytes()[0];
>this.boundary[1] = new String(new byte[]{Character.LETTER_NUMBER}, "iso-8859-
1").getBytes()[0];
>this.boundary[2] = new String(new byte[]{0x2D},"iso-8859-1").getBytes()[0];
>this.boundary[3] = new String(new byte[]{0x2D},"iso-8859-1").getBytes()[0];
Line 293
if (arrayequals(marker, STREAM_TERMINATOR, 2))
>if (arrayequals(marker, new String(STREAM_TERMINATOR,"iso-8859-1" ).getBytes
(getHeaderEncoding()), 2))
Line 396
else if (arrayequals(marker, FIELD_SEPARATOR, 2))
>else if (arrayequals(marker, new String(FIELD_SEPARATOR,"iso-8859-1").getBytes
(getHeaderEncoding()), 2))
Line 480
if (b[0] == HEADER_SEPARATOR[i])
>if (b[0] == new String(HEADER_SEPARATOR,"iso-8859-1").getBytes
(getHeaderEncoding())[i])
etc........
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org