Mercurial > hg > soundsoftware-site
diff app/models/changeset.rb @ 120:cd2282d2aa55 cannam
Merge from the default branch. Note that this is not a valid SVN repository any more (use default, redmine-1.1 etc for SVN updates).
author | Chris Cannam |
---|---|
date | Thu, 13 Jan 2011 14:33:08 +0000 |
parents | b859cc0c4fa1 8661b858af72 |
children | eeebe205a056 |
line wrap: on
line diff
--- a/app/models/changeset.rb Thu Jan 13 13:21:03 2011 +0000 +++ b/app/models/changeset.rb Thu Jan 13 14:33:08 2011 +0000 @@ -245,7 +245,13 @@ 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