scm: Ruby 1.9 compatibility for log.

Remove assuming UTF-8 is valid.
"\xC2\x80" of latin-1(iso-8859-1) is valid sequence of UTF-8.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4925 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA
2011-02-22 13:39:12 +00:00
parent 4257b1d9ad
commit 9f50e63583
2 changed files with 19 additions and 7 deletions
-7
View File
@@ -245,13 +245,6 @@ class Changeset < ActiveRecord::Base
end
def self.to_utf8(str)
if str.respond_to?(:force_encoding)
str.force_encoding('UTF-8')
return str if str.valid_encoding?
else
return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii
end
encoding = Setting.commit_logs_encoding.to_s.strip
unless encoding.blank? || encoding == 'UTF-8'
begin