From: Toshi MARUYAMA Date: Wed, 17 Aug 2011 11:14:03 +0000 (+0000) Subject: Merge r6021 from trunk (#8825). X-Git-Tag: 1.2.2~45 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2302955bc5af93bfa33ae69febf9ac69eeb90bcf;p=redmine.git Merge r6021 from trunk (#8825). scm: fix JRuby tests fail in unit changeset following test. * test_invalid_utf8_sequences_in_paths_should_be_replaced Following Subversion functional tests fail on Japanese Windows + JRuby 1.6.2 (ruby-1.8.7-p330). * test_directory_diff * test_revision_diff git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.2-stable@6453 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- 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 = ""