Reputation: 4848
I'm working on an existing project in the configuration file I found this filter that I didn't understand the the purpose of this filter Spring CharacterEncodingFilter I read some documentation but still i didn't understand how it's work :
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
Any help Thank you
Upvotes: 2
Views: 2971
Reputation: 421
I think documentation is pretty clear: http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/filter/CharacterEncodingFilter.html
"Servlet Filter that allows one to specify a character encoding for requests. This is useful because current browsers typically do not set a character encoding even if specified in the HTML page or form."
Upvotes: 3