MySql UTF-8 palaikymas ant Railsų
2006-03-22
Jeigu pradėjote dirbti su RubyOnRails ir turite problemų su UTF-8 palaikymu bei naudojate MySql DBVS app/controllers/application.rb faile esančioje ApplicationController klasėje įrašykite
before_filter :configure_charsets
def configure_charsets
@headers["Content-Type"] = "text/html; charset=utf-8"
suppress(ActiveRecord::StatementInvalid) do
ActiveRecord::Base.connection.execute 'SET NAMES UTF8'
end
end