Great, worked nicely!

----- Original Message ----- From: "Alan Comeau" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Monday, January 16, 2006 10:51 AM
Subject: RE: Struts UTF-8




If you are using the 2.4 servlet spec it is pretty easy to use UTF-8 you
need to install a servlet filter.



public class ServletCharacterEncodingFilter implements Filter {
 private FilterConfig config;
/** Creates a new instance of SetCharacterEncodingFilter */
 public ServletCharacterEncodingFilter() {
 }

   public void doFilter(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain
filterChain) throws java.io.IOException, javax.servlet.ServletException
{

servletRequest.setCharacterEncoding(config.getInitParameter("charset"));

servletResponse.setCharacterEncoding(config.getInitParameter("charset"))
;
     filterChain.doFilter(servletRequest, servletResponse);
   }

   public void destroy() {
   }

   public void init(javax.servlet.FilterConfig filterConfig) throws
javax.servlet.ServletException {
     config = filterConfig;
   }
}

in web.xml you add

<filter>
     <filter-name>setCharaterEncoding</filter-name>

<filter-class>com.bhb.servlet.filter.ServletCharacterEncodingFilter</fil
ter-class>
     <init-param>
        <param-name>charset</param-name>
        <param-value>8859_1</param-value>
     </init-param>
  </filter>


hope this helps.


-----Original Message-----
From: Marcio Ghiraldelli [mailto:[EMAIL PROTECTED] Sent: 16 January 2006 13:38
To: user@struts.apache.org
Subject: Struts UTF-8

   I am trying to use UTF-8 in my Tomcat 5.5 / Struts 1.2.7 app, but my
form beans shows "??" chars in place of international chars.

   1) My JSP's has the UTF-8 encoding declaration
   <[EMAIL PROTECTED] pageEncoding="UTF-8"%>

   2) The Tomcat java proccess is running with UTF-8 option:
/usr/local/jdk1.5.0_05/bin/java -Dfile.encoding=UTF-8
   The third step is to translate the default ISO request sent by
traditional browsers to UTF chars, but Struts automatically populate the
formbean when the form is submited, how can I do this?

   Thanks

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




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

Reply via email to