开发者

JSF ISO-8859-2 charset

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开发者_C百科-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.


The logging I did was misleading. It turned out that stdout replaced special characters with '?' character. But, characters which were written to db were also replaced by '?' sign. The other part of the problem was that JConnector hasn't been set for correct encoding, so db entries looked very much like logged properties. I didn't realize that it was a combination of two problems.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜