scm: prevent diff shows trace if UTF-8 is invalid in Ruby 1.9.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4912 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-02-21 14:28:41 +00:00 committed by Eric Davis
parent d95201c917
commit 39332b7a72
1 changed files with 4 additions and 0 deletions

View File

@ -132,6 +132,10 @@ module RepositoriesHelper
# do nothing here and try the next encoding
end
end
if str.respond_to?(:force_encoding)
str = str.encode("ASCII-8BIT", :invalid => :replace,
:undef => :replace, :replace => '?').encode("UTF-8")
end
str
end