epugh       2004/12/03 02:43:13

  Modified:    xdocs    changes.xml
               src/java/org/apache/turbine/util/parser
                        DefaultParameterParser.java
  Log:
  Handle non US-ASCII encoding with multipart/form-data mimetype properly.
  
  Revision  Changes    Path
  1.96      +3 -0      jakarta-turbine-2/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/xdocs/changes.xml,v
  retrieving revision 1.95
  retrieving revision 1.96
  diff -u -r1.95 -r1.96
  --- changes.xml       24 Nov 2004 18:23:44 -0000      1.95
  +++ changes.xml       3 Dec 2004 10:43:13 -0000       1.96
  @@ -24,6 +24,9 @@
   
     <body>
       <release version="2.4-M2" date="in cvs">
  +      <action dev="epugh" type="fix" due-to="Leandro Rodrigo Saad Cruz">
  +        Handle non US-ASCII encoding with multipart/form-data mimetype 
better.
  +      </action>              
         <action dev="epugh" type="remove">
           Remove Merlin service.  When the replacement for Merlin (Metro) is 
released, then
           add back in support.
  
  
  
  1.22      +20 -2     
jakarta-turbine-2/src/java/org/apache/turbine/util/parser/DefaultParameterParser.java
  
  Index: DefaultParameterParser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/util/parser/DefaultParameterParser.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- DefaultParameterParser.java       16 Feb 2004 07:06:27 -0000      1.21
  +++ DefaultParameterParser.java       3 Dec 2004 10:43:13 -0000       1.22
  @@ -69,6 +69,8 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
  +import org.apache.turbine.Turbine;
  +import org.apache.turbine.TurbineConstants;
   import org.apache.turbine.services.upload.TurbineUpload;
   import org.apache.turbine.services.upload.UploadService;
   
  @@ -106,6 +108,8 @@
       extends BaseValueParser
       implements ParameterParser, Recyclable
   {
  +    private String defaultCharSet;
  +
       /** Logging */
       private static Log log = LogFactory.getLog(DefaultParameterParser.class);
   
  @@ -189,6 +193,19 @@
           return this.request;
       }
   
  +     private String getDefaultCharset()
  +     {
  +             if (defaultCharSet == null)
  +             {
  +                     /* Get the default charset and cache it in a static 
variable. */
  +                     defaultCharSet = Turbine.getConfiguration()
  +                             
.getString(TurbineConstants.LOCALE_DEFAULT_CHARSET_KEY,
  +                                     
TurbineConstants.LOCALE_DEFAULT_CHARSET_DEFAULT);
  +                     log.debug("defaultCharSet = " + defaultCharSet + " 
(From Properties)");
  +             }
  +             return defaultCharSet;
  +     }
  +
       /**
        * Sets the servlet request to be parser.  This requires a
        * valid HttpServletRequest object.  It will attempt to parse out
  @@ -209,7 +226,8 @@
           uploadData = null;
   
           String enc = request.getCharacterEncoding();
  -        setCharacterEncoding(enc != null ? enc : "US-ASCII");
  +             String charset = getDefaultCharset();
  +        setCharacterEncoding(enc != null ? enc : charset);
   
           // String object re-use at its best.
           String tmp = null;
  
  
  

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

Reply via email to