Author: kenfinni
Date: 2012-02-01 09:54:02 -0500 (Wed, 01 Feb 2012)
New Revision: 8345
Modified:
portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/WebAppController.java
Log:
GTNPORTAL-2342: Unicode characters encoding error
- Set the Character Encoding to UTF-8 before the Request parameters are retrieved
Modified:
portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/WebAppController.java
===================================================================
---
portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/WebAppController.java 2012-02-01
11:31:54 UTC (rev 8344)
+++
portal/trunk/component/web/controller/src/main/java/org/exoplatform/web/WebAppController.java 2012-02-01
14:54:02 UTC (rev 8345)
@@ -19,8 +19,26 @@
package org.exoplatform.web;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import org.exoplatform.commons.utils.Safe;
-import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.component.RequestLifeCycle;
import org.exoplatform.container.xml.InitParams;
@@ -42,22 +60,6 @@
import org.gatein.common.http.QueryStringParser;
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicReference;
-import javax.servlet.ServletConfig;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
/**
* The WebAppController is the entry point of the GateIn service.
@@ -309,6 +311,17 @@
public void service(HttpServletRequest req, HttpServletResponse res) throws Exception
{
boolean debug = log.isDebugEnabled();
+
+ try
+ {
+ // We set the character encoding now to UTF-8 before obtaining parameters
+ req.setCharacterEncoding("UTF-8");
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ log.error("Encoding not supported", e);
+ }
+
String portalPath = req.getRequestURI().substring(req.getContextPath().length());
Router router = routerRef.get();