Author: sichen
Date: Mon Jun 11 14:22:14 2007
New Revision: 546292
URL:
http://svn.apache.org/viewvc?view=rev&rev=546292Log:
A slightly modified version of Krzystof Podejma's OFBIZ-1072 patch for encoding of uploads
Modified:
ofbiz/branches/release4.0/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java
Modified: ofbiz/branches/release4.0/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release4.0/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java?view=diff&rev=546292&r1=546291&r2=546292==============================================================================
--- ofbiz/branches/release4.0/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java (original)
+++ ofbiz/branches/release4.0/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java Mon Jun 11 14:22:14 2007
@@ -128,11 +128,15 @@
maxUploadSize = -1;
}
+ String encoding = request.getCharacterEncoding();
// check for multipart content types which may have uploaded items
boolean isMultiPart = FileUpload.isMultipartContent(request);
Map multiPartMap = new HashMap();
if (isMultiPart) {
DiskFileUpload upload = new DiskFileUpload();
+ if (encoding != null) {
+ upload.setHeaderEncoding(encoding);
+ }
upload.setSizeMax(maxUploadSize);
List uploadedItems = null;
@@ -163,7 +167,16 @@
Debug.logWarning("Form field found [" + fieldName + "] which was not handled!", module);
}
} else {
- multiPartMap.put(fieldName, item.getString());
+ if (encoding != null) {
+ try {
+ multiPartMap.put(fieldName, item.getString(encoding));
+ } catch (java.io.UnsupportedEncodingException uee){
+ Debug.logError(uee, "Unsupported Encoding, using deafault", module);
+ multiPartMap.put(fieldName, item.getString());
+ }
+ } else {
+ multiPartMap.put(fieldName, item.getString());
+ }
}
} else {
String fileName = item.getName();