DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27702>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27702

MultipartPost values cannot contain latin1 characters when server is running on linux

           Summary: MultipartPost values cannot contain latin1 characters
                    when server is running on linux
           Product: Struts
           Version: Nightly Build
          Platform: PC
               URL: http://http://
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: File Upload
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


SYMPTOM:

Take a Multipart Post form, enter latin1 characters (tested with german 
umlauts) and submit. Works if server is running on windows. If server is 
running on Linux umlauts are replaced with '?'.

REASON: in CommonsMultipartRequestHandler.java

 450          try {
 451              value = item.getString(request.getCharacterEncoding());
 452          } catch (Exception e) {
 453              value = item.getString();
 454          }

for some reason getCharacterEncoding() is null, so struts uses
value = item.getString();

this function is using the default character encoding of the platform. On 
windows it is 8859-1 which is also the default encoding for HTTP so this works 
more or less by accident. If tomcat is running on other platforms, like Linux 
it is not.

SOLUTION: if no encoding is given, use ISO-8859-1, not platform-dependent
encoding.

EXAMPLE: Working patch:
   448          try {
   449              value = item.getString(request.getCharacterEncoding());
   450          } catch (Exception e) {
   451              try {
   452                   value = item.getString("ISO-8859-1");
   453              } catch (java.io.UnsupportedEncodingException uee) {
   454                   value = item.getString();
   455              }
   456          }

Cheers!

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to