I am currently using the jQuery-File-Upload. I may upload some files with a Japanese or Chinese file name, and I can see that the file name is for example, \"お疲れ様です.txt\" or \"测
As Stephen C said a filter can be used to get the right encoding. We had this problem on JBOSS 7.1.1 and implemented a filter.
In web xml
<filter>
<display-name>set character encoding</display-name>
<filter-name>RequestEncodingFilter</filter-name>
<filter-class>com.myapp.RequestEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>RequestEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Filter class:
public class RequestEncodingFilter implements Filter {
private static final String ENCODING = "encoding";
private String configuredEncoding;
@Override
public void init(FilterConfig filterConfig) throws ServletException {
configuredEncoding = filterConfig.getInitParameter(ENCODING);
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
servletRequest.setCharacterEncoding(configuredEncoding);
filterChain.doFilter(servletRequest, servletResponse);
}
@Override
public void destroy() {
}
}