Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring MVC编码问题_Java_Spring Mvc_Tomcat_Intellij Idea_Thymeleaf - Fatal编程技术网

Java Spring MVC编码问题

Java Spring MVC编码问题,java,spring-mvc,tomcat,intellij-idea,thymeleaf,Java,Spring Mvc,Tomcat,Intellij Idea,Thymeleaf,我正在使用SpringMVC和Thymeleaf。当我发布一个包含®作为参数的表单时,它将以windows-1252格式而不是utf-8显示 以下是我在表单中发布的输入: <input type="checkbox" name="brand" id="brand1" value="Brand®"> 我做了一些研究,发现®在windows-1252中等于%AE,但在utf-8中等于%C2%AE。当我用%C2%AE手动发布URL时,它会正确地解释它 我在Windows7上使用Intel

我正在使用SpringMVC和Thymeleaf。当我发布一个包含®作为参数的表单时,它将以windows-1252格式而不是utf-8显示

以下是我在表单中发布的输入:

<input type="checkbox" name="brand" id="brand1" value="Brand®">
我做了一些研究,发现®在windows-1252中等于%AE,但在utf-8中等于%C2%AE。当我用%C2%AE手动发布URL时,它会正确地解释它

我在Windows7上使用Intellij14.1.3,我的web服务器是Tomcat8.0.21。 启动Tomcat 8.0.3-RC,Tomcat中的默认URI编码设置为utf-8,我还验证了IntelliJ中的IDE和项目编码设置为utf-8。另外,我的HTML文件在开头有
标记

你知道我如何解决这个问题吗


提前感谢

我相信spring附带了一个字符编码过滤器,它将在HttpServletRequest对象上设置编码。你试过研究它吗?是的,我在我的配置中有以下内容:public ReloadableResourceBundleMessageSource getMessageSource(){ReloadableResourceBundleMessageSource resource=new ReloadableResourceBundleMessageSource();resource.setBasename(“classpath:i18n/messages”);resource.setDefaultEncoding(“UTF-8”);return resource;}我猜这会覆盖默认值。
http://localhost:8080/categories?brand=Brand%AE&x=87&y=37