Edwin Chen
2010-Oct-13 23:46 UTC
what is the default valule for "encoding" in ActiveRecord::Base.establish_connection
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 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Edwin Chen
2010-Oct-14 04:30 UTC
Re: what is the default valule for "encoding" in ActiveRecord::Base.establish_connection
question closed. I didn''t figure out a way to get the default value for encoding. But when I set the :encoding to "latin1", I will get the same result. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.