diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-06-09 01:29:22 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-06-09 01:29:22 +0000 |
commit | 8427048d5d7a47ff0fe22f066d243c860185797c (patch) | |
tree | 8f089393d760a3cceaf1e0441ba3daa27cbac446 /app | |
parent | f8c0a4da63959d706b250dcb874d948052da1347 (diff) | |
download | redmine-8427048d5d7a47ff0fe22f066d243c860185797c.tar.gz redmine-8427048d5d7a47ff0fe22f066d243c860185797c.zip |
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
Diffstat (limited to 'app')
-rw-r--r-- | app/models/changeset.rb | 7 |
1 files changed, 7 insertions, 0 deletions
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 = "" |