diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-01-01 19:12:35 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-01-01 19:12:35 +0000 |
commit | ad727d378100bba88ee16df38f534f1d6fd495db (patch) | |
tree | 81cfca52c7b4342b956b26213539b0e854681bd3 /app/models/changeset.rb | |
parent | 488285e12321fc590dee0235470cfb12d77a3432 (diff) | |
download | redmine-ad727d378100bba88ee16df38f534f1d6fd495db.tar.gz redmine-ad727d378100bba88ee16df38f534f1d6fd495db.zip |
Fixes utf8 conversions with ruby1.9.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4605 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/changeset.rb')
-rw-r--r-- | app/models/changeset.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/changeset.rb b/app/models/changeset.rb index 804719481..ca4daace8 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -227,7 +227,13 @@ class Changeset < ActiveRecord::Base end def self.to_utf8(str) - return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii + 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 |