You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jason Zhou <Ja...@sas.com> on 2002/09/12 14:56:19 UTC
Handling submitted form data with different encoding
It seems to me that there is no guarantee the browser will pass the right encoding to the servlet container.
What I did are:
1. Specify the content type for the JSP output using <%@ page contentType="text/html; charset=utf-8" %>, which ensures that the JSP page is treated as UTF-8 able to represent all the characters needed.
2. Specify the content type to the browser using <meta http-equiv="content-type" content="text/html; charset=utf-8">. Since the browser uses the encoding of the page to send form data, submissions will now use UTF-8.
3. Set up a filter that unconditionally sets the character encoding to be used in parsing the incoming request to utf-8 specified by the encoding filter initialization parameter in the web app deployment descriptor (/WEB-INF/web.xml). The call made in ther filtering process is request.setCharacterEncoding(encoding).
The above steps should guarantee all form input will be taken in by servlet container in utf-8, regardless of locale. Would you please comment on that?
Best Regards,
J. Jason Zhou
Business Intelligence Platform Division (BIP), R & D,
SAS Institute, 100 SAS Campus Dr.
Cary, North Carolina 27513-8617
Voice: 919-531-0568(O)
Email: jason.zhou@sas.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>