简体   繁体   中英

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. 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.

You can access to my project under Github

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. I guess the text from your java scource files are not displaying correctly. 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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM