tomcat导致中文url编码失败
不是spring容器也是不servlet问题
设置setCharacterEncoding 编码情况下中文依旧乱码
在tomcat 配置server文件中
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" URIEncoding="UTF-8"/>
URIEncoding="UTF-8" 方可解决
方案二:
spring配置中添加
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>application/json;charset=UTF-8</value>
<value>text/plain;charset=UTF-8</value>
<value>text/html;charset=UTF-8</value>
</list>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
@RequestMapping(value = "/add",produces="text/html;charset=UTF-8")