scm: set empty log encoding UTF-8 in Ruby 1.9 and add tests.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5368 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA committed 2011-04-09 06:34:33 +00:00
1 parent e297c1c244
commit 1b0473c38e
2 files changed
+40 -1

No files matched your search

+4 -1
View File
@@ -247,7 +247,10 @@ class Changeset < ActiveRecord::Base
def self.to_utf8(str, encoding)
return str if str.nil?
str.force_encoding("ASCII-8BIT") if str.respond_to?(:force_encoding)
return str if str.empty?
if str.empty?
str.force_encoding("UTF-8") if str.respond_to?(:force_encoding)
return str
end
str.force_encoding("UTF-8") if str.respond_to?(:force_encoding)
if str.respond_to?(:force_encoding)
enc = encoding.blank? ? "UTF-8" : encoding