scm: fix JRuby tests fail in unit changeset following test.

* test_invalid_utf8_sequences_in_paths_should_be_replaced

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6021 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-06-09 01:30:05 +00:00
parent 8427048d5d
commit a367732d4d
1 changed files with 7 additions and 0 deletions

View File

@ -11,6 +11,13 @@ module Redmine
str = str.encode("US-ASCII", :invalid => :replace,
:undef => :replace, :replace => '?').encode("UTF-8")
end
elsif RUBY_PLATFORM == 'java'
begin
ic = Iconv.new('UTF-8', 'UTF-8')
str = ic.iconv(str)
rescue
str = str.gsub(%r{[^\r\n\t\x20-\x7e]}, '?')
end
else
ic = Iconv.new('UTF-8', 'UTF-8')
txtar = ""