Description: Force table encoding in mysql mysql default encoding is not UTF8, but forcing table encoding is possible. dbconfig-common does not provide appropriate configuration variable, so here the mysql adapter is modified to respect encoding set in database.yml Forwarded: not-needed Author: Jérémy Lal Bug-Debian: http://bugs.debian.org/599374 Bug-Rails: http://rails.lighthouseapp.com/projects/8994/tickets/5830 Last-Update: 2010-10-17 Index: b/config/initializers/10-patches.rb =================================================================== --- a/config/initializers/10-patches.rb 2011-03-08 10:26:57.000000000 +0100 +++ b/config/initializers/10-patches.rb 2011-03-08 10:26:57.000000000 +0100 @@ -1,6 +1,22 @@ require 'active_record' +require 'active_record/connection_adapters/abstract_adapter' +module ActiveRecord + module ConnectionAdapters + class MysqlAdapter < AbstractAdapter + def create_table(table_name, options = {}) #:nodoc: + encoding = @config[:encoding] + if encoding + options = options.reverse_merge(:options => "DEFAULT CHARSET=#{encoding}") + end + super(table_name, options.reverse_merge(:options => "ENGINE=InnoDB")) + end + end + end +end + + module ActiveRecord class Base include Redmine::I18n