如何在全局的Rails中设置#encoding:utf-8

现在我在每个控制器中使用# encoding: utf-8 ,其中:通知消息不在拉丁语中我试图将它放在ApplicationController中,试图在顶部添加 application.html.erb,没有用,有什么帮助吗?

编辑: config.encoding =“utf-8”也在application.rb中设置

编辑:

此代码出现错误:

 redirect_to root_url, :notice => "Вышли успешно" 

这是一个错误

 :syntax error, unexpected $end, expecting '}' ..._or_to root_url, :notice => 'Вышли успешно.' } 

这是ruby 1.9的Set global default encoding的副本,但在你的情况下,我建议使用I18n

 redirect_to root_url, :notice => I18n.t 'sessions.destroy.success' # config/locales/ru.yml ru: sessions: destroy: success: Вышли успешно 

至于locales键命名,AFAIK没有约定,这里我使用“controller_name.action_name.result”方案。