Index: src/org/apache/wiki/ui/WikiJSPFilter.java
===================================================================
--- src/org/apache/wiki/ui/WikiJSPFilter.java	(revision 1435937)
+++ src/org/apache/wiki/ui/WikiJSPFilter.java	(working copy)
@@ -247,7 +247,7 @@
     private static class MyServletResponseWrapper
         extends HttpServletResponseWrapper
     {
-        private CharArrayWriter m_output;
+        private ByteArrayOutputStream m_output;
       
         /** 
          *  How large the initial buffer should be.  This should be tuned to achieve
@@ -258,9 +258,16 @@
         public MyServletResponseWrapper( HttpServletResponse r )
         {
             super(r);
-            m_output = new CharArrayWriter( INIT_BUFFER_SIZE );
+            m_output = new ByteArrayOutputStream( INIT_BUFFER_SIZE );      
         }
 
+        public String getCharacterEncoding()
+        {
+            ServletResponse r = super.getResponse();
+            String s = r.getCharacterEncoding();
+            return s;
+        }
+
         /**
          *  Returns a writer for output; this wraps the internal buffer
          *  into a PrintWriter.
@@ -277,12 +284,12 @@
 
         static class MyServletOutputStream extends ServletOutputStream
         {
-            CharArrayWriter m_buffer;
+            ByteArrayOutputStream m_buffer;
 
-            public MyServletOutputStream(CharArrayWriter aCharArrayWriter)
+            public MyServletOutputStream(ByteArrayOutputStream bos)
             {
                 super();
-                m_buffer = aCharArrayWriter;
+                m_buffer = bos;
             }
 
             public void write(int aInt)
@@ -297,7 +304,19 @@
          */
         public String toString()
         {
-            return m_output.toString();
+            byte[] b = m_output.toByteArray();
+            String s = null;
+            String encoding = getCharacterEncoding();
+             
+            try
+            {
+                s = new String(b,encoding);
+            }
+            catch (UnsupportedEncodingException e)
+            {
+            }
+             
+            return s;
         }
     }
 
