Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.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 Boot应用程序的UTF-8编码?_Java_Spring_Spring Boot_Spring Mvc_Freemarker - Fatal编程技术网

Java 如何修复Spring Boot应用程序的UTF-8编码?

Java 如何修复Spring Boot应用程序的UTF-8编码?,java,spring,spring-boot,spring-mvc,freemarker,Java,Spring,Spring Boot,Spring Mvc,Freemarker,下面是我的Spring Boot应用程序的几个配置。我使用FreeMarker作为MVC解析器。 这是maven配置: <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-p

下面是我的Spring Boot应用程序的几个配置。我使用FreeMarker作为MVC解析器。 这是maven配置:

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <executable>true</executable>
                    <jvmArguments>-Dfile.encoding=UTF8</jvmArguments>
                </configuration>
            </plugin>
        </plugins>
    </build>
这是我的
应用程序.properties
文件的一部分

# FRONTEND
spring.freemarker.enabled=true
spring.freemarker.template-loader-path=classpath:/templates/
spring.freemarker.expose-request-attributes=true
spring.freemarker.content-type=text/html
spring.freemarker.charset=UTF-8
我还将这些行添加到我的
.ftl
文件中:

<#ftl encoding='UTF-8'>
<head>
        <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"/>
        ...
</head>

...

但我仍然使用“Windows-1252”编码,这就是为什么我在页面上看不到俄语字母的原因。如何修复它?

这有帮助吗?不,不幸的是,它没有帮助尝试用双引号关闭属性值,像这样有帮助吗?不,不幸的是,它没有帮助尝试用双引号关闭属性值,比如
<#ftl encoding='UTF-8'>
<head>
        <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"/>
        ...
</head>