[英]Spring MVC and MustacheViewResolver character encoding issue
I'm trying Mustache View Resolver with Spring MVC, but in my Html view, im getting character encoding issue. 我正在尝试使用Spring MVC的Mustache View Resolver,但是在我的HTML视图中,我遇到了字符编码问题。 I tried many solutions to solve this problem but couldnt handle this.
我尝试了许多解决方案来解决此问题,但无法解决。
I have an basic ArrayList model, Mustache resolves Turkish characters correctly but outside of templated words, makes no sense. 我有一个基本的ArrayList模型,Mustache可以正确解析土耳其语字符,但是在模板化单词之外是没有意义的。
You can access to my project under Github 您可以在Github下访问我的项目
https://github.com/rahmanusta/SpringMvcMustache https://github.com/rahmanusta/SpringMvcMustache
I see you added a section to configure the maven-compiler-plugin
in your pom.xml
, and you have UTF-8 characters in your Java source code files. 我看到您在
pom.xml
添加了配置maven-compiler-plugin
的部分,并且Java源代码文件中包含UTF-8字符。 I guess the text from your java scource files are not displaying correctly. 我想您的Java搜寻文件中的文本无法正确显示。 If that is the case, telling the compiler plugin explicitely which encoding to use might help:
如果是这种情况,则明确地告诉编译器插件使用哪种编码可能会有所帮助:
<build>
<finalName>MvcMustache</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<!-- fetch encoding from definition up in the pom.xml -->
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.