在使用tomcat作为web容器,使用springMVC进行开发时,前端调用后台接口时,如果参数是中文的话,在后台观察会发现中文是乱码
此时的解决办法之一:修改tomcat安装目录下conf/server.xml,在
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
添加 URIEncoding='utf-8',修改为
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding='utf-8'/>
就OK了