2

Spring 3JSF 2MYSQLHibernateを使用しており、Heidi SQLはデータベースのGUIツールであり、アラビア文字のエンコードに問題があります。アラビア語がデータベースに挿入され、??????????のビューに表示されます。同じ形。

これが私のエンコーディング構成です:

1-データベース:

  • 文字セット:utf 8

  • 照合:utf8_general_ci

2-春:

私は次のフィルターを使用しています:

<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>

3- JSF:

私の知る限り:FaceletsはUTF-8デフォルトで使用します。

4-休止状態:

データベースの接続URLは次のとおりです。

jdbc:mysql://127.0.0.1:3306/mydb?zeroDateTimeBehavior=convertToNull&useUnicode=true&connectionCollation=utf8_general_ci&characterSetResults=utf8

構成に何かが足りない場合はアドバイスしてください。

4

2 に答える 2

2

You forgot the characterEncoding=UTF-8 parameter in your JDBC URL. Here's the revised JDBC URL with the minimum required parameters to let it handle UTF-8 properly:

jdbc:mysql://127.0.0.1:3306/mydb?useUnicode=true&characterEncoding=UTF-8

See also:

于 2012-04-03T13:24:24.050 に答える
1

if you use tomcat you will need to add the following argument to configuration Arguments:

-Dfile.encoding=UTF-8 

in addition to the above hibernate configuration.

于 2012-05-07T10:56:39.090 に答える