summaryrefslogtreecommitdiffstats
path: root/lib/redmine/codeset_util.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-06-09 01:30:05 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-06-09 01:30:05 +0000
commita367732d4d213736291e8a7a6e6bd1f68f96a111 (patch)
treed59463445e8a37b6669d028a7c8fb795b8bcdf1c /lib/redmine/codeset_util.rb
parent8427048d5d7a47ff0fe22f066d243c860185797c (diff)
downloadredmine-a367732d4d213736291e8a7a6e6bd1f68f96a111.tar.gz
redmine-a367732d4d213736291e8a7a6e6bd1f68f96a111.zip
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
Diffstat (limited to 'lib/redmine/codeset_util.rb')
-rw-r--r--lib/redmine/codeset_util.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/redmine/codeset_util.rb b/lib/redmine/codeset_util.rb
index 20156b827..945b3ea7b 100644
--- a/lib/redmine/codeset_util.rb
+++ b/lib/redmine/codeset_util.rb
@@ -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 = ""