Author: niallp Date: Mon Feb 13 18:21:28 2006 New Revision: 377579 URL: http://svn.apache.org/viewcvs?rev=377579&view=rev Log: Fix for Bug 34445 - use charsets given by browser for form field encodings - reported by Ralf Hauser.
Modified: struts/action/trunk/src/java/org/apache/struts/upload/CommonsMultipartRequestHandler.java Modified: struts/action/trunk/src/java/org/apache/struts/upload/CommonsMultipartRequestHandler.java URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/java/org/apache/struts/upload/CommonsMultipartRequestHandler.java?rev=377579&r1=377578&r2=377579&view=diff ============================================================================== --- struts/action/trunk/src/java/org/apache/struts/upload/CommonsMultipartRequestHandler.java (original) +++ struts/action/trunk/src/java/org/apache/struts/upload/CommonsMultipartRequestHandler.java Mon Feb 13 18:21:28 2006 @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package org.apache.struts.upload; import org.apache.commons.fileupload.DiskFileUpload; +import org.apache.commons.fileupload.disk.DiskFileItem; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.logging.Log; @@ -46,8 +47,7 @@ * interface by providing a wrapper around the Jakarta Commons FileUpload * library. </p> * - * @version $Rev$ $Date: 2005-05-07 12:11:38 -0400 (Sat, 07 May 2005) - * $ + * @version $Rev$ $Date$ * @since Struts 1.1 */ public class CommonsMultipartRequestHandler implements MultipartRequestHandler { @@ -380,7 +380,21 @@ String name = item.getFieldName(); String value = null; boolean haveValue = false; - String encoding = request.getCharacterEncoding(); + String encoding = null; + + if (item instanceof DiskFileItem) { + encoding = ((DiskFileItem)item).getCharSet(); + if (log.isDebugEnabled()) { + log.debug("DiskFileItem.getCharSet=[" + encoding + "]"); + } + } + + if (encoding == null) { + encoding = request.getCharacterEncoding(); + if (log.isDebugEnabled()) { + log.debug("request.getCharacterEncoding=[" + encoding + "]"); + } + } if (encoding != null) { try { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]