Grails 1.2.x 中文亂碼問題處理

底下為以前的記錄,當時使用的版本是 Grails 1.2.x

  • grails 產生的 gsp 格式不是 utf-8, 須手動自行調整。
  • 確認 Config.groovy 裡的 grails.views.gsp.encoding=”UTF-8″
  • gsp 檔案裡的 meta:
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  • jdbc 裡的 url 有指定 characterEncoding=utf8&useUnicode=true, Example:
    jdbc:mysql://localhost:3306/mydb?characterEncoding=utf8&useUnicode=true
  • phpMyAdmin:
    建立資料庫時, 校對=utf8_general_ci
    MySql 連線校對=utf8_general_ci

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s