I'm trying to get file name from request header, I'm getting character encoding problem despite I have defined Spring encoding filter in my web.xml.
String fileName = request.getHeader("X-File-Name"); // wrong encoding
web.xml
<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>
<filter-mapping>
<filter-name>CharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Also I've added URIEncoding="UTF-8" config into Tomcat server.xml file.
And added same config JAVA_OPTS too.
-DuriEncoding=UTF-8 -Dfile.encoding=UTF-8