Added page method getCharacterEncoding. CLK-764

git-svn-id: https://svn.apache.org/repos/asf/click/trunk/click@1096510 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/org/apache/click/ClickServlet.java b/framework/src/org/apache/click/ClickServlet.java
index 30144a1..425ec23 100644
--- a/framework/src/org/apache/click/ClickServlet.java
+++ b/framework/src/org/apache/click/ClickServlet.java
@@ -939,6 +939,8 @@
 
         response.setContentType(page.getContentType());
 
+        response.setCharacterEncoding(page.getCharacterEncoding());
+
         Writer writer = getWriter(response);
 
         if (page.hasHeaders()) {
diff --git a/framework/src/org/apache/click/Page.java b/framework/src/org/apache/click/Page.java
index 2e573e5..523ccc8 100644
--- a/framework/src/org/apache/click/Page.java
+++ b/framework/src/org/apache/click/Page.java
@@ -135,6 +135,7 @@
  * <li>{@link #model} to populate the Velocity Context</li>
  * <li>{@link #format} to add to the Velocity Context</li>
  * <li>{@link #getContentType()} to set as the HttpServletResponse content type</li>
+ * <li>{@link #getContentType()} to set as the HttpServletResponse content type</li>
  * <li>{@link #headers} to set as the HttpServletResponse headers</li>
  * </ul>
  *
@@ -449,27 +450,30 @@
     }
 
     /**
+     * Return the HTTP response character encoding. By default this method returns
+     * the request character encoding via
+     * {@link javax.servlet.ServletRequest#getCharacterEncoding()}
+     * <p/>
+     * The ClickServlet uses the pages character encoding for setting the
+     * HttpServletResponse character encoding.
+     *
+     * @return the HTTP response content type
+     */
+    public String getCharacterEncoding() {
+        return getContext().getRequest().getCharacterEncoding();
+    }
+
+    /**
      * Return the HTTP response content type. By default this method returns
      * <tt>"text/html"</tt>.
      * <p/>
-     * If the request specifies a character encoding via
-     * If {@link javax.servlet.ServletRequest#getCharacterEncoding()}
-     * then this method will return <tt>"text/html; charset=encoding"</tt>.
-     * <p/>
      * The ClickServlet uses the pages content type for setting the
      * HttpServletResponse content type.
      *
      * @return the HTTP response content type
      */
     public String getContentType() {
-        String charset = getContext().getRequest().getCharacterEncoding();
-
-        if (charset == null) {
-            return "text/html";
-
-        } else {
-            return "text/html; charset=" + charset;
-        }
+        return "text/html";
     }
 
     /**