This content has been marked as final.
Show 2 replies
-
1. Re: How to set Character Encoding correctly?
spec_third Jul 13, 2006 9:10 PM (in response to spec_third)b.jsp?names=??
?? is chinese character.
Anybody help? thanks. -
2. Re: How to set Character Encoding correctly?
lxiao Feb 7, 2007 2:23 AM (in response to spec_third)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'.