1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-22 16:31:12 +00:00

unify duplicate codes (#24616)

git-svn-id: http://svn.redmine.org/redmine/trunk@16272 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2017-01-28 05:43:33 +00:00
parent 3e2d20ad91
commit 281bc5c454

View File

@ -25,11 +25,7 @@ module Redmine
str = str.encode("UTF-8", :invalid => :replace,
:undef => :replace, :replace => '?')
else
str.force_encoding("UTF-8")
if ! str.valid_encoding?
str = str.encode("US-ASCII", :invalid => :replace,
:undef => :replace, :replace => '?').encode("UTF-8")
end
str = replace_invalid_utf8(str)
end
str
end