diff --git a/app/views/common/_diff.html.erb b/app/views/common/_diff.html.erb index 94434fe86..0d30bedd2 100644 --- a/app/views/common/_diff.html.erb +++ b/app/views/common/_diff.html.erb @@ -10,7 +10,7 @@ - <%= Redmine::CodesetUtil.to_utf8_by_setting(table_file.file_name) %> + <%= table_file.file_name %> @@ -24,11 +24,11 @@ <%= line.nb_line_left %> -
<%= Redmine::CodesetUtil.to_utf8_by_setting(line.html_line_left).html_safe %>
+
<%= line.html_line_left.html_safe %>
<%= line.nb_line_right %> -
<%= Redmine::CodesetUtil.to_utf8_by_setting(line.html_line_right).html_safe %>
+
<%= line.html_line_right.html_safe %>
<% end -%> @@ -40,7 +40,7 @@ - <%= Redmine::CodesetUtil.to_utf8_by_setting(table_file.file_name) %> + <%= table_file.file_name %> @@ -55,7 +55,7 @@ <%= line.nb_line_left %> <%= line.nb_line_right %> -
<%= Redmine::CodesetUtil.to_utf8_by_setting(line.html_line).html_safe %>
+
<%= line.html_line.html_safe %>
<% end -%> diff --git a/lib/redmine/unified_diff.rb b/lib/redmine/unified_diff.rb index 9917a554f..d08ab5c01 100644 --- a/lib/redmine/unified_diff.rb +++ b/lib/redmine/unified_diff.rb @@ -30,15 +30,8 @@ module Redmine diff_table = DiffTable.new(diff_type, diff_style) diff.each do |line| line_encoding = nil - if line.respond_to?(:force_encoding) - line_encoding = line.encoding - # TODO: UTF-16 and Japanese CP932 which is imcompatible with ASCII - # In Japan, diffrence between file path encoding - # and file contents encoding is popular. - line.force_encoding('ASCII-8BIT') - end - unless diff_table.add_line line - line.force_encoding(line_encoding) if line_encoding + line = Redmine::CodesetUtil.to_utf8_by_setting(line) + unless diff_table.add_line(line) self << diff_table if diff_table.length > 0 diff_table = DiffTable.new(diff_type, diff_style) end