From: Toshi MARUYAMA Date: Mon, 21 Feb 2011 14:28:41 +0000 (+0000) Subject: scm: prevent diff shows trace if UTF-8 is invalid in Ruby 1.9. X-Git-Tag: 1.2.0~911 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=111ae3c2e95843b1506a68541f0a9198a1e8724f;p=redmine.git 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 --- diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 50a1ba240..28397c945 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -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