Encoding problem with rails 1.2 and MySql 5.0

Hi all,

I want my rails application and ferret to support utf-8, so I create a database in MySql 5.0 using utf-8 charset and add the following declarations in environment.rb:

$KCODE = 'u' require 'jcode' ENV['LANG'] = 'zh_CN.utf8' require 'acts_as_ferret'

After that, I enter some chinese characters from the web page I've created. Everything is OK, I can see all the text in the correct encoding. But as I turn to my database and check the data in the tables, I can only see some meaningless characters(while these meaningless characters can be showed correctly in the web pages). Further more, if I enter some data directly to the database, the web pages will show these data as a group of "?". I think there must be something wrong with the encoding setting but I cannot tell what it is. Anybody know how to solve this? Thanks very much.