0

Mojibake problem

[I use netbeans - jsf 2.2 - primefaces 4.0 - Mysql database]

I use Arabic in my JSF application and unfortunately the Arabic values sent to the server as other characters like this (بÙÙس Ùب ) (seen by debugger) and so stored in database like this.

the project work well at the beginning but after I do some other tasks in my project this problem occur but what cause the problem I do not know

the following solutions done but no effect

use the following line at every jsf page (.xhtml page)

<meta http-equiv="content-type" content="text/html;charset=utf-8"/>

use the following filter

<filter>
    <filter-name>encoding-filter</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>encoding-filter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>

and also I try my written filter

I use the form like this

<h:form  acceptcharset="UTF-8" enctype="application/form-data">

Any one can help me

4

1 回答 1

0

这里的问题

重新配置服务器以使用 UTF-8 而不是 ISO-8859-1 作为默认编码。在 Glassfish 中,只需将以下条目添加到 /WEB-INF/glassfish-web.xml 文件中:

<parameter-encoding default-charset="UTF-8" />
于 2014-07-07T12:41:39.567 回答