存储库视图中的错误Redmin ActionView :: Template :: Error(不兼容的字符编码:ASCII-8BIT和UTF-8)

时间:2017-03-15 08:41:27

标签: git repository redmine

我配置了几个月的Redmin来查看GIT存储库(在同一台服务器上),因为我尝试显示存储库页面的几天我有一个错误500,我再也看不到提交的票据(#ticket numero) 。错误是:

Rendered repositories/_navigation.html.erb (17.6ms)
  Rendered repositories/show.html.erb within layouts/base (22.9ms)
Completed 500 Internal Server Error in 401ms (ActiveRecord: 9.1ms)

ActionView::Template::Error (incompatible character encodings: ASCII-8BIT     and UTF-8):
27:                    :id => 'tag' %>
28:   <% end -%>
29: 
30:   <% if @repository.supports_all_revisions? %>
31:     | <%= l(:label_revision) %>: 
32:     <%= text_field_tag 'rev', @rev, :size => 8 %>
33:   <% end %>
  app/views/repositories/_navigation.html.erb:30:in `block in     _app_views_repositories__navigation_html_erb__997203925942952170_70174274845000'
  app/views/repositories/_navigation.html.erb:9:in `_app_views_repositories__navigation_html_erb__997203925942952170_70174274845000'
  app/views/repositories/show.html.erb:4:in `_app_views_repositories_show_html_erb___3665620718196763072_70174275009180'
  app/controllers/repositories_controller.rb:125:in `show'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

我已经在版本0.3.11中使用了mysql2 gem 我有utf8配置

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine 
  password: redmine
  encoding: utf8

并在environment.rb中:

Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8

我不知道我能做什么我知道这是一个在评论或标题标签或其他我的reprository编码的问题,但在检查gitlab时我没有发现任何奇怪的事。

任何想法?

1 个答案:

答案 0 :(得分:3)

要使其工作,我必须更改文件redmine / lib / redmine / scm / adapters

l89添加这一行:

bran.force_encoding("UTF-8") if bran.respond_to?(:force_encoding) 

l102替换

@tags = io.readlines.sort!.map{|t| t.strip}

通过

@tags = io.readlines.sort!.map do |tag|
          tag = tag.strip
          tag.force_encoding("UTF-8") if tag.respond_to?(:force_encoding)
          tag
        end

关注