Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

character encoding issue

Adam Hardy

2003-12-14

Replies:

This is something I thought I had sorted out but somehow it popped its
ugly head up again today.

I have tomcat 5.0.16 and I'm setting the character encoding for my JSPs
in the web.xml with the new config mechanism:

 <jsp-config>
  <jsp-property-group>
    <description>All JSPs</description>
    <url-pattern>/WEB-INF/general/*</url-pattern>
    <el-ignored>false</el-ignored>
    <page-encoding>UTF-8</page-encoding>
    <is-xml>false</is-xml>
  </jsp-property-group>
 </jsp-config>

That handles the response and I fix the request by setting all request
character encoding in a filter.

I have this simple JSP scriptlet:

<%
 String role = request.getParameter("role");
 if (role == null)
  role = "";
 if (role.length() > 0) {
  if (request.isUserInRole(role)) {
%>
    You have been granted role <strong><%= role %></strong><br /><br />
<%
  }
%>

But the JSP destroys my German characters like ? ?& ?

I put debug output in the JSP with the following:

request.getCharacterEncoding();
response.getCharacterEncoding();

It shows UTF-8 for both.

This does however setup work for my servlets, which successfully input &
output the German characters between the browser and the database.

What am I doing wrong anybody?

Thanks
Adam
--
struts 1.1 + tomcat 5.0.16 + java 1.4.2
Linux 2.4.20 Debian

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)



©2008 junlu.com - Jax Systems, LLC, U.S.A.