客户端跳转到中文名的HTML页面,跳转失败,浏览器上显示乱码,服务路径也显示乱码,查询资料,得出如下修改方式:(项目全是UTF-8)
message=new String(message.getBytes("utf-8"),"iso-8859-1");//解决浏览器中文乱码问题,这样浏览器显示正常
服务器端中文乱码配置
<Connector connectionTimeout="20000" port="8080" URIEncoding="utf-8" useBodyEncodingForURI="true" protocol="HTTP/1.1" redirectPort="8443"/>
在sever.xml中找到端口配置的地方,添加 URIEncoding="utf-8" useBodyEncodingForURI="true"
重新运行后成功!