> -----Original Message-----
> From: Giannis [mailto:[EMAIL PROTECTED]]
> Sent: 27-08-2001 1:46 PM
> To: [EMAIL PROTECTED]
> Subject: charset problem
> 
> I make some JSP pages on Jacarta tomcat.
> I have problem with the character set.
> I use content type ISO-8859-7 but the server doesnt appear the
characters
> (it appear ?????????) even if  I use a META tag or a
> page directive for the contentType.
> The problem is especially on request.getParameter when I submit a
form.
> Please help

If you are you using Tomcat4.0 then I can suggest a solution that works
for me.

In the beginning of .jsp file I had following:
-------------------------------------------------------------------
<%@ page contentType="text/html; charset=iso-8859-15"
pageEncoding="iso-8595-15"
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

<head>
  <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-15">
...
-------------------------------------------------------------------

and Tomcat still sent this with page encoding set to iso-8859-1.

With the help of
webapps/examples/WEB-INF/classes/filters/SetCharacterEncodingFilter.java
you can serve pages with correct encoding. Configuration example is
given
in webapps/examples/WEB-INF/web.xml and it goes like this:

<!-- Example filter to set character encoding on each request -->
<filter>
  <filter-name>Set Character Encoding</filter-name>
  <filter-class>filters.SetCharacterEncodingFilter</filter-class>
  <init-param>
    <param-name>encoding</param-name>
    <!-- put your encoding here -->
    <param-value>iso-8859-15</param-value>
  </init-param>
</filter>

To use this filter you have to set up filter mapping:

<filter-mapping>
  <filter-name>Set Character Encoding</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>


Just make sure you have filter.SetCharacterEncodingFilter in your
classpath or you can copy SetCharacterEncodingFilter.class into
<your_webapp>/WEB-INF/classes/filter directory.

Hope this works for you too.

with best wishes,
Taavi



Reply via email to