commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ignacio Coloma (JIRA)" <j...@apache.org>
Subject [jira] Updated: (FILEUPLOAD-161) Default headerEncoding should be ISO-8859-1
Date Wed, 04 Jun 2008 14:55:45 GMT

     [ https://issues.apache.org/jira/browse/FILEUPLOAD-161?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Ignacio Coloma updated FILEUPLOAD-161:
--------------------------------------

    Description: 
When the browser does not include an encoding, commons-fileupload is using the system default,
but the standard says that it should be using ISO-8859-1:

https://bugzilla.mozilla.org/show_bug.cgi?id=241540

The link includes links to the corresponding sections of the RFC. This issue is related to
FILEUPLOAD-56 and FILEUPLOAD-100.

To reproduce this bug, try to upload a file including special characters from a ISO-8859-1
browser (firefox or explorer on windows) to a UTF-8 server with tomcat. The file contents
arrive fine, but any special characters in the filename get lost. 

A patch follows.


  was:
When the browser does not include an encoding, commons-fileupload is using the system default,
but the standard says that it should be using ISO-8859-1:

https://bugzilla.mozilla.org/show_bug.cgi?id=241540

The post includes links to the RFC. This issue is related to FILEUPLOAD-56 and FILEUPLOAD-100.

To reproduce this bug, try to upload a file including special characters from a ISO-8859-1
browser (firefox or explorer on windows) to a UTF-8 server with tomcat. The file contents
arrive fine, but any special characters in the filename get lost. A patch follows:


Index: src/java/org/apache/commons/fileupload/MultipartStream.java
===================================================================
--- src/java/org/apache/commons/fileupload/MultipartStream.java	(revision 663089)
+++ src/java/org/apache/commons/fileupload/MultipartStream.java	(working copy)
@@ -552,15 +552,11 @@
         }
 
         String headers = null;
-        if (headerEncoding != null) {
-            try {
-                headers = baos.toString(headerEncoding);
-            } catch (UnsupportedEncodingException e) {
-                // Fall back to platform default if specified encoding is not
-                // supported.
-                headers = baos.toString();
-            }
-        } else {
+        try {
+            headers = baos.toString(headerEncoding != null? headerEncoding : "ISO-8859-1");
+        } catch (UnsupportedEncodingException e) {
+            // Fall back to platform default if specified encoding is not
+            // supported.
             headers = baos.toString();
         }
 



> Default headerEncoding should be ISO-8859-1
> -------------------------------------------
>
>                 Key: FILEUPLOAD-161
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-161
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2.1
>            Reporter: Ignacio Coloma
>         Attachments: patch.txt
>
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> When the browser does not include an encoding, commons-fileupload is using the system
default, but the standard says that it should be using ISO-8859-1:
> https://bugzilla.mozilla.org/show_bug.cgi?id=241540
> The link includes links to the corresponding sections of the RFC. This issue is related
to FILEUPLOAD-56 and FILEUPLOAD-100.
> To reproduce this bug, try to upload a file including special characters from a ISO-8859-1
browser (firefox or explorer on windows) to a UTF-8 server with tomcat. The file contents
arrive fine, but any special characters in the filename get lost. 
> A patch follows.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message