3 Replies Latest reply on Feb 12, 2009 7:20 AM by Nick Belaevski

    Encoding problem with RichFaces

    Felix Sima Newbie


      Note: The romanian characters are not correctly displayed on this forum.
      Please see the same post on www.javaranch.com:

      I am developing a web application using JBoss 5.0.0.GA + RichFaces 3.2.2.GA and I want to use romanian characters on my pages.
      The problem is that on my pages these characters are not displayed correctly. More precisely, if I put these characters directly on my page
      they are displayed correctly, but if I use

      <h:outputText value="#{customMessages.judet}"/>

      then they are not correctly displayed.

      I have tried to instruct RichFaces to use UTF-8 encoding, but seems like I am missing something.

      My JSP:
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">
      <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <h:outputText value="#{customMessages.judet}"/>

      I have specified the below filter on my web.xml to be used instead of the default one
      import org.ajax4jsf.Filter;
      public class UTF8Filter extends Filter {
       private final String ENCODING = "UTF-8";
       public void doFilter(final ServletRequest request, final ServletResponse response, FilterChain chain) throws IOException, ServletException {
       super.doFilter(request, response, chain);

       <display-name>UTF-8 RichFaces Filter</display-name>
       <servlet-name>Faces Servlet</servlet-name>

      On the run.bat script that launches JBoss application server I added

      I don't know if it is important, but my page (the welcome page of my application) is display after a redirect, like this:

      <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
      <jsp:forward page="/welcome.faces"/>

      Am I missing something? Or is there any error on my code above?
      Any help would be highly appreciated.

      Best regards,
      Use www.jaaava.com - A Google for Java !!!