Stack Exchange
How to fix UTF-8 encoding for a Spring Boot App?
Here are several configs of my Spring Boot application. I use FreeMarker as the MVC resolver.
This is maven config:
<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>

This is my config class:
@Configuration
@EnableWebMvc
@RequiredArgsConstructor
public class ApplicationWebMvcConfig extends WebMvcConfigurerAdapter {

    private final FreeMarkerViewResolver freemarkerViewResolver;

    @Override
    public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
        configurer.enable();
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/templates/").addResourceLocations("/templates/");
    }

    @Override
    public void configureViewResolvers(ViewResolverRegistry registry) {
        registry.freeMarker();
        registry.viewResolver(freemarkerViewResolver);
    }

    @Bean
    public FreeMarkerViewResolver freemarkerViewResolver() {
        FreeMarkerViewResolver resolver = new FreeMarkerViewResolver();
        resolver.setContentType("text/html;charset=utf-8");
        resolver.setPrefix("templates/");
        resolver.setSuffix(".ftl.html");
        return resolver;
    }

    @Bean
    public CharacterEncodingFilter characterEncodingFilter() {
        CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
        characterEncodingFilter.setForceEncoding(true);
        characterEncodingFilter.setEncoding("UTF-8");
        characterEncodingFilter.setForceRequestEncoding(true);
        characterEncodingFilter.setForceRequestEncoding(true);
        return characterEncodingFilter;
    }
}

This is a part of my application.properties file
# 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

I also added these lines into my .ftl files:
<#ftl encoding='UTF-8'>
<head>
        <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"/>
        ...
</head>

But I'm still getting the "Windows-1252" encoding, that's why I can't see russian letters on my pages. How to fix it?

does this help? Ensure that your .ftl page is encoded with utf-8

No, unluckily it didn't help

Try closing attribute value in double quotes like <#ftl encoding="utf-8">
