iso-8859-1 is the default page encoding for web pages.  To use anything else you need 
to tell the webserver.


Use this at the top of every jsp page:

<%@ page contentType="text/html; charset=UTF-8"%>

Or for Tomcat 5 you can use Servelt 2.4/JSP2.0 spec and set the page encoding in the web.xml

   <jsp-config>
   <jsp-property-group>
       <url-pattern>*.jsp</url-pattern>
       <page-encoding>UTF-8</page-encoding>
   </jsp-property-group>
   </jsp-config>


Olve SÃther Hansen wrote:

I have some problems using struts/tiles and UTF-8 characters embedded in
an jsp page.

How can I make struts/tiles respect the system default encoding, and not
use iso-8859-1 for all jsp pages?


This problem occurs in tomcat 4.1.29, 5.0.19 and 5.0.27.
I have a struts version bundled with Appfuse, all I know is that it is
from 2003-12.02 (that is 2. december).

It seems like struts is hard-coding the response encoding to be
ISO-8859-1, although the response-encoding is set to be UTF-8 for all
requests..

In a struts-action I execute this code:
log.debug("res encoding: " +response.getCharacterEncoding());
log.debug("req encoding: " +request.getCharacterEncoding());

resulting in:
res encoding: ISO-8859-1
req encoding: UTF-8

I use the SpringFramework characterEncodingFilter to force utf-8.
My web-browser reports the page to be encoded in utf-8.

If I use iconv (a Linux program for converting files from one encoding
to another) to convert a file containing utf-8 characters (norwegian
characters à à Ã) to iso-8859-1, the pages displays correctly.

My web-browser still reports the page as being encoded in utf-8.

If I write the same Norwegian letters in a jsp page outside of
struts/tiles control, the page displays without problems..

So, is there a way to make struts/tiles respect the system default
encoding, and not use iso-8859-1 for all jsp pages?


Hope someone can help me solve this problem, I have looked through most
email archives I can find without any solution.





--
Jason Lea



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to