i'm using struts 1.1, oracle 10g environment
i'm facing a problem that i can't save special characters as "ẻ, €" from the
page to database correctly though i used all the possible ways to set the
encoding to utf-8
her's the code i used
1- in the.jsp page ..
  <%@ page language="java" pageEncoding="UTF-8"
contentType="text/html;charset=UTF-8" %>

 and in the header ..
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

and declare the form ..
  <form method="post" accept-charset="UTF-8" action="<%=actionName%>">

2- i used an encoding filter ...

package controller;

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;


public class EncodingFilter implements Filter {

  private String encoding = "UTF-8";

  public void doFilter(ServletRequest request,
      ServletResponse response, FilterChain filterChain)
      throws IOException, ServletException {

    request.setCharacterEncoding(encoding);
    filterChain.doFilter(request, response);
  }

  public void init(FilterConfig filterConfig)
                   throws ServletException {
    String encodingParam = filterConfig
              .getInitParameter("encoding");
    if (encodingParam != null) {
      encoding = encodingParam;
    }
  }

  public void destroy() {
    // nothing todo
  }
}

and declared it as following in web.xml ...
  <?xml version = '1.0' encoding = 'UTF-8'?>

and ..

  <filter>
      <filter-name>EncodingFilter</filter-name> 
      <filter-class>controller.EncodingFilter</filter-class> 
     <init-param>
      <param-name>encoding</param-name> 
      <param-value>UTF-8</param-value> 
      </init-param>
    </filter>
    <filter-mapping>
      <filter-name>EncodingFilter</filter-name> 
      <url-pattern>/*</url-pattern> 
    </filter-mapping>

3- in struts-config ...
  <?xml version="1.0" encoding= "UTF-8" ?>

and ..
  <controller  contentType="text/html; charset=UTF-8" 
               
multipartClass="org.apache.struts.upload.CommonsMultipartRequestHandler"
                nocache="true" />

the point is the the characters reaches the action class corectly but when i
save to datbase an retrieve again it's viewed corrupted in the page 

any help please??
  
-- 
View this message in context: 
http://www.nabble.com/struts-request-encoding-to-utf-8-problem-tp15041079p15041079.html
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to