一般Tocant 的url编码是iso-8859-1(查看tocat/conf/server.xml 中的Connector 节点没有写URIEncoding="xxxxxx") 如下:
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
最后我这个问题是这么解决:
(1)Tomcat中server.xml中,红色为新加设置
<Connector URIEncoding="UTF-8" port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
(2)服务器代码处理编码设置
response.setCharacterEncoding("UTF-8");
(3)html页面
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
时间: 2024-11-08 10:59:52