]> source.dussan.org Git - redmine.git/commitdiff
scm: prevent diff shows trace if UTF-8 is invalid in Ruby 1.9.
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Mon, 21 Feb 2011 14:28:41 +0000 (14:28 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Mon, 21 Feb 2011 14:28:41 +0000 (14:28 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4912 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/repositories_helper.rb

index 50a1ba24017198b3e6cc258e600921ca42679aee..28397c945f37181df5515b0f6fd625bcee05c323 100644 (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