Rails中文化不需要瞎折騰

CharlesCui發表於2007-11-09

環境:

Rails 1.2.5

ruby 1.8.5 (2006-08-25) [i386-mswin32]

MySQL:

mysql> status
--------------
mysql Ver 14.12 Distrib 5.0.27, for Win32 (ia32)

Connection id: 13
Current database:
Current user:
SSL: Not in use
Using delimiter: ;
Server version: 5.0.27-community-nt
Protocol version: 10
Connection: localhost via TCP/IP
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
TCP port: 3306
Uptime: 23 min 37 sec

Threads: 3 Questions: 242 Slow queries: 0 Opens: 44 Flush tables: 1 Open tables: 24 Queries per second avg: 0.171
--------------

IDE:EditPlus V2.31 工具->引數選擇->文字->預設編碼->UTF-8

====================================

1、確定MySQL資料庫編碼是utf8
2、database.yml裡面增加encoding: utf8
3、確定rhtml檔案編碼是UTF-8

====================================

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9934490/viewspace-981415/,如需轉載,請註明出處,否則將追究法律責任。

相關文章