Hi guys,
I am using mysql. Recently I changed the character set from Latin1 to
UTF-8.
I met an issue when I inserted a new record. It showed up some illegal
characters. Per my test, I thought it converted the value from UTF-8 to
Latin1 and then saved in table.
If I add “:encoding => “utf8”” to establiash_connection method, the
problem will be solved. Is there any default value for :encoding in
establish_connection?
ActiveRecord::Base.establish_connection(
:adapter => “mysql”,
:host => “localhost”,
:username => “edwin”,
:password => “123456”,
:database => “products”
)
Thanks in advance