scm: code clean up app/models/changeset.rb.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5371 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
5511155674
commit
0adf1a87b1
@ -245,17 +245,18 @@ class Changeset < ActiveRecord::Base
|
|||||||
str.force_encoding("UTF-8") if str.respond_to?(:force_encoding)
|
str.force_encoding("UTF-8") if str.respond_to?(:force_encoding)
|
||||||
return str
|
return str
|
||||||
end
|
end
|
||||||
str.force_encoding("UTF-8") if str.respond_to?(:force_encoding)
|
|
||||||
if str.respond_to?(:force_encoding)
|
if str.respond_to?(:force_encoding)
|
||||||
enc = encoding.blank? ? "UTF-8" : encoding
|
enc = encoding.blank? ? "UTF-8" : encoding
|
||||||
if enc != "UTF-8"
|
if enc != "UTF-8"
|
||||||
str.force_encoding(enc)
|
str.force_encoding(enc)
|
||||||
str = str.encode("UTF-8", :invalid => :replace,
|
str = str.encode("UTF-8", :invalid => :replace,
|
||||||
:undef => :replace, :replace => '?')
|
:undef => :replace, :replace => '?')
|
||||||
end
|
else
|
||||||
if ! str.valid_encoding?
|
str.force_encoding("UTF-8")
|
||||||
str = str.encode("US-ASCII", :invalid => :replace,
|
if ! str.valid_encoding?
|
||||||
:undef => :replace, :replace => '?').encode("UTF-8")
|
str = str.encode("US-ASCII", :invalid => :replace,
|
||||||
|
:undef => :replace, :replace => '?').encode("UTF-8")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
unless encoding.blank? || encoding == 'UTF-8'
|
unless encoding.blank? || encoding == 'UTF-8'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user