Fix for CONNECTORS-1661.
git-svn-id: https://svn.apache.org/repos/asf/manifoldcf/trunk@1886468 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES.txt b/CHANGES.txt
index 6f895ec..4a0329f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -3,6 +3,10 @@
======================= 2.19-dev =====================
+CONNECTORS-1661: Encoding for multipart requests is sometimes not set by the new
+UI, so assume UTF-8 if that happens.
+(Julien Massiera)
+
CONNECTORS-1662: Apparently sometimes JIRA doesn't form the encoding properly.
(Julien Massiera)
diff --git a/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/multipart/MultipartWrapper.java b/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/multipart/MultipartWrapper.java
index 93d656e..bf438cb 100644
--- a/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/multipart/MultipartWrapper.java
+++ b/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/multipart/MultipartWrapper.java
@@ -49,6 +49,15 @@
public MultipartWrapper(HttpServletRequest request, AdminProfile adminProfile)
throws ManifoldCFException
{
+ // First of all make sure to have a correct charset
+ if(request.getCharacterEncoding() == null) {
+ try {
+ request.setCharacterEncoding("UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ throw new ManifoldCFException(e.getMessage(), e);
+ }
+ }
+
this.adminProfile = adminProfile;
// Check that we have a file upload request