JSF ISO-8859-2 charset
Posted
by Vladimir
on Stack Overflow
See other posts from Stack Overflow
or by Vladimir
Published on 2010-04-18T09:52:36Z
Indexed on
2010/04/18
9:53 UTC
Read the original article
Hit count: 468
Hi!
I have problem with setting proper charset on my jsf pages. I use MySql db with latin2 (ISO-8859-2 charset) and latin2_croatian_ci collation. But, I have problems with setting values on backing managed bean properties.
Page directive on top of my page is:
<%@ page language="java" pageEncoding="ISO-8859-2" contentType="text/html; charset=ISO-8859-2" %>
In head I included:
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-2">
And my form tag is:
<h:form id="entityDetails" acceptcharset="ISO-8859-2">
I've created and registered Filter in web.xml with following doFilter method implementation:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
request.setCharacterEncoding("ISO-8859-2");
response.setCharacterEncoding("ISO-8859-2");
chain.doFilter(request, response);
}
But, i.e. when I set managed bean property through inputText, all special (unicode) characters are replaced with '?' character.
I really don't have any other ideas how to set charset to pages to perform well. Any suggestions?
Thanks in advance.
© Stack Overflow or respective owner