访问管理员/设置时出现内部错误(UTF-8中的无效字节序列)

时间:2013-10-21 18:02:09

标签: localization jruby redmine strftime


我的配置:

Ruby implementation:
  jruby 1.7.5 (1.9.3p392) 2013-10-07 74e9291 on Java HotSpot(TM) Client VM 1.7.0_25-b16 [Windows Server 2008 R2-x86]
Operating system:
  Microsoft Windows Server 2008 R2 [Version 6.1.7601]
Database:
  PostgreSQL 9.3
Server:
  Webrick
Environment:
  Redmine version 2.3.3.stable
  Ruby version 1.9.3-p392 (2013-10-07) [java]
  Rails version 3.2.13
  Environment production
  Database adapter PostgreSQL
Redmine plugins:
  no plugin installed

当我尝试使用俄语翻译访问Admin->设置时,我会收到内部错误:

ActionView::Template::Error (invalid byte sequence in UTF-8):
  7:
  8: <p><%= setting_select :start_of_week, [[day_name(1),'1'], [day_name(6),'6'], [day_name(7),'7']], :blank => :label_language_based ></p>
  9: < locale = User.current.language.blank? ? ::I18n.locale : User.current.language %>
  10: <p><%= setting_select :date_format, Setting::DATE_FORMATS.collect {|f| [::I18n.l(Date.today, :locale => locale, :format => f), f]}, :blank => :label_language_based %></p>
  11:
  12: <p><%= setting_select :time_format, Setting::TIME_FORMATS.collect {|f| [::I18n.l(Time.now, :locale => locale, :format => f), f]}, :blank => :label_language_based %></p>
  13:
app/helpers/settings_helper.rb:38:in `setting_select'
app/views/settings/_display.html.erb:10:in `_app_views_settings__display_html_erb__912948922_14104'
app/views/settings/_display.html.erb:1:in `_app_views_settings__display_html_erb__912948922_14104'
app/views/common/_tabs.html.erb:24:in `_app_views_common__tabs_html_erb__398022901_13972'
app/views/common/_tabs.html.erb:23:in `_app_views_common__tabs_html_erb__398022901_13972'
app/helpers/application_helper.rb:271:in `render_tabs'
app/views/settings/edit.html.erb:3:in `_app_views_settings_edit_html_erb___540221663_13968'
app/controllers/settings_controller.rb:28:in `index'

如果我将config / locales / ru.ymlmonth_name'октября'替换为'October'并且时间:am'утра'替换为'am',那么一切都很顺利。 请帮我以正确的方式解决这个问题 感谢您的帮助!
PS:抱歉我的英文不好:)

2 个答案:

答案 0 :(得分:0)

问题在于jruby strftime:它打破了格式字符串中的unicode字符...用jruby 1.7.6版本修复。

答案 1 :(得分:0)

我用chmod 0777 tmp / cache

解决了这个问题