【发布时间】:2011-02-07 07:52:52
【问题描述】:
我正在使用 rails 2.3.10 和 ruby 1.9.2
我的问题可以归结为:
# ---------------------------
# SomeViewsController.rb
# ---------------------------
def index
I18n.locale = :kr
@news = News.new(:title => "추가", :body => "Place text here")
@news.save
end
# ---------------------------
# ---------------------------
# some_views/index.html.erb
# ---------------------------
TITLE: <%= @news.title %>
# ---------------------------
我的问题出在 I18n.locale 部分。当我将其设置为韩语 (:kr) 时,出现此错误
ActionView::TemplateError(不兼容的字符编码:UTF-8 和 ASCII-8BIT)
但是当我将它设置为“en”或默认值时,它会很好地显示韩文字符。
拜托,谁能告诉我这是怎么回事?
【问题讨论】:
标签: ruby-on-rails internationalization