My web applications is currently using:
- JBoss AS7
- JSF2
- PrimeFaces
Due to this bug UTF-8 form submit in JSF is corrupting data I setup a @WebFilter doing
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
chain.doFilter(request, response);
}
as suggested by BalusC (thank you).
In a simple it always works right. I come to another problem when I need to use the same form for file upload, too (e.g. http://www.primefaces.org/showcase-labs/ui/fileUploadDnd.jsf)
Here's the main difference
<h:form enctype="multipart/form-data">
WITHOUT the enctype attribute, special unicode characters remains readable.
WITH the enctype attribute, I find "ciaò" instead of "ciaò".
My filter @WebFilter("/*") EncodingFilter
is always called however.
Could a possible solution be setting JBoss default encoding to utf-8? How can I do that?
*** * EDIT ****
I also tried putting -Dfile.encoding=UTF-8 in my JAVA_OPTS but nothing.... it won't work :(( Please help me!