Add this on your spring boot project:
@Bean
@Order(Ordered.HIGHEST_PRECEDENCE)
public FilterRegistrationBean<CharacterEncodingFilter> characterEncodingFilterRegistration() {
CharacterEncodingFilter filter = new CharacterEncodingFilter();
filter.setEncoding("UTF-8"); // use your preferred encoding
filter.setForceEncoding(true); // force the encoding
FilterRegistrationBean<CharacterEncodingFilter> registrationBean =
new FilterRegistrationBean<>(filter); // register the filter
registrationBean.addUrlPatterns("/*"); // set preferred url
return registrationBean;
}
Top comments (1)
Hello, Calvin June.
I am working in a Spring Boot application. I have added this code snippet in my Application.java class. But my character encoding is not fixed yet. If I submit বাংলা it is saved as মà§à¦ মিà¦à¦¾à¦¨à§à¦° রহমান
Can you help me regarding this encoding, please? Can you show me the full procedure?