You also need to set up the input field encoding in addition of page character set. 
You can do so field by field to convert the input string encoding or using the 
following filter from the PetStore.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mport 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;
import javax.servlet.http.HttpServletRequest;


public class EncodingFilter implements Filter {

    // default to ASCII
    private String targetEncoding = "ASCII";

    public void init(FilterConfig config) throws ServletException {
        this.targetEncoding = config.getInitParameter("encoding");
    }

    public void destroy() {
        targetEncoding = null;
    }

     public  void doFilter(ServletRequest srequest, ServletResponse  sresponse, 
FilterChain chain)
        throws IOException, ServletException {

        HttpServletRequest request = (HttpServletRequest)srequest;
        request.setCharacterEncoding(targetEncoding);
        // move on to the next
       chain.doFilter(srequest,sresponse);
    }
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
And setup this filter for all JSP files in your web.xml.

Hope this helps.


--

--------- Original Message ---------

DATE: Thu, 4 Dec 2003 12:58:54 
From: "Yansheng Lin" <[EMAIL PROTECTED]>
To: "'Tag Libraries Users List'" <[EMAIL PROTECTED]>
Cc: 

>
>Hi,
>
>I have trouble processing user's input using UTF-8 encoding.  I can change to
>different locales with 
>  <fmt:setLocale value='${sessionScope["org.apache.struts.action.LOCALE"]}'/>, 
>but I don't think 
>  <fmt:requestEncoding value='UTF-8'/> 
>is working for me right now. I already set the page encoding in my hearder with:
>  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
>
>Here is my Systen.out in the beginning of dispatchAction():
>
>        System.out.println(request.getCharacterEncoding());
>        System.out.println(request.getContentType());
>        System.out.println(request.getLocale());        
>
>And this is what I get:
>         null
>         application/x-www-form-urlencoded
>         en_US
>
>I am not sure what's missing right now.  Do I have to set anything in the
>web.xml?
>
>Thanks in advance!
>
>-Yan
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>



____________________________________________________________
Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
http://login.mail.lycos.com/r/referral?aid=27005

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

Reply via email to