java中文参数乱码解决方法

【方法一】后端接收参数时转码

String fileName = new String (fileName.getBytes("ISO8859-1"),"utf-8");

【方法二】修改tomcat安装目录下的server.xml(推荐)

<!-- 添加:URIEncoding="UTF-8" -->
<Connector port="8080" protocol="HTTP/1.1"

               connectionTimeout="20000"

               redirectPort="8443" 

               URIEncoding="UTF-8"/>

猜你喜欢

转载自blog.csdn.net/qq_37584445/article/details/82223443