Forum: Ruby on Rails Encoding problem with rails 1.2 and MySql 5.0

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
1292dfc5df2064e008f7f12b9c56561d?d=identicon&s=25 allen (Guest)
on 2007-04-23 06:25
(Received via mailing list)
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.
This topic is locked and can not be replied to.