scm: return if str.blank? in to_utf8(str).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4960 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-02-28 08:03:43 +00:00
parent d7aa303a5c
commit f03e338880
2 changed files with 2 additions and 0 deletions

View File

@ -117,6 +117,7 @@ module RepositoriesHelper
end end
def to_utf8(str) def to_utf8(str)
return str if str.blank?
if str.respond_to?(:force_encoding) if str.respond_to?(:force_encoding)
str.force_encoding('UTF-8') str.force_encoding('UTF-8')
else else

View File

@ -247,6 +247,7 @@ class Changeset < ActiveRecord::Base
end end
def self.to_utf8(str) def self.to_utf8(str)
return str if str.blank?
encoding = Setting.commit_logs_encoding.to_s.strip encoding = Setting.commit_logs_encoding.to_s.strip
unless encoding.blank? || encoding == 'UTF-8' unless encoding.blank? || encoding == 'UTF-8'
begin begin