From 8427048d5d7a47ff0fe22f066d243c860185797c Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Thu, 9 Jun 2011 01:29:22 +0000 Subject: [PATCH] scm: fix JRuby tests fail in unit changeset following test. * test_invalid_utf8_sequences_in_comments_should_be_replaced_ja_jis * test_invalid_utf8_sequences_in_comments_should_be_replaced_latin1 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6020 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/changeset.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/models/changeset.rb b/app/models/changeset.rb index 60ab87864..27565c6de 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -272,6 +272,13 @@ class Changeset < ActiveRecord::Base :undef => :replace, :replace => '?').encode("UTF-8") end end + elsif RUBY_PLATFORM == 'java' + begin + ic = Iconv.new('UTF-8', enc) + str = ic.iconv(str) + rescue + str = str.gsub(%r{[^\r\n\t\x20-\x7e]}, '?') + end else ic = Iconv.new('UTF-8', enc) txtar = "" -- 2.39.5