[jboss-user] [Tomcat, HTTPD, Servlets & JSP] - Re: How to set Character Encoding correctly?
lxiao
do-not-reply at jboss.com
Wed Feb 7 02:23:22 EST 2007
your setting i think is right.
but location.href=encodeURI("b.jsp?names=??");
why you need to encode. i think:
location.href="b.jsp?names=??";
can be OK.
"spec_third" wrote : Hi,anybody help me
|
| I write two jsp files. Content as following:
| a.jsp
| ------------------------------------------------
|
| | <%@ page language="java" contentType="text/html; charset=UTF-8"%>
| | <html>
| | <HEAD>
| | <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
| | </HEAD>
| | <body>
| | <script language="javascript">
| | function _goto(){
| | location.href=encodeURI("b.jsp?names=??");
| | }
| | </script>
| | </body>
| | </html>
|
| b.jsp
| ------------------------------------------------------------------
|
| | <%@ page language="java" contentType="text/html; charset=UTF-8"%>
| | <html>
| | <HEAD>
| | <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
| | </HEAD>
| | <body>
| | <%
| | request.setCharacterEncoding("UTF-8");
| | String names = request.getParameter("names");
| | System.out.println("Names:"+names);
| | %>
| | </body>
| | </html>
|
| following is configuration:
| jbossweb-tomcat50.sar/server.xml
|
|
| | <Service name="jboss.web" className="org.jboss.web.tomcat.tc5.StandardService">
| | <Connector useBodyEncodingForURI="true" URIEncoding="UTF-8"/>
| |
|
| Console print:
| Names:????????????
|
| While I set 'useBodyEncodingForURI' to false,Console print is OK:
| Names:??
|
| why? what is real meaning of 'useBodyEncodingForURI=true'.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4012288#4012288
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4012288
More information about the jboss-user
mailing list