summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-04-12 05:04:45 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-04-12 05:04:45 +0000
commit5bb06ae42d53adb03d370a48ef7eebd8d420392c (patch)
tree75f263518be95e015aad662bd0b70d53ab293cd1
parentbb48d96d3037c9ef909af310fc21ef19b7550d52 (diff)
downloadredmine-5bb06ae42d53adb03d370a48ef7eebd8d420392c.tar.gz
redmine-5bb06ae42d53adb03d370a48ef7eebd8d420392c.zip
scm: additional test of replacing invalid utf-8 sequences instead of stripping in displaying repository contents on Ruby 1.8.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5428 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--test/unit/helpers/repository_helper_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/unit/helpers/repository_helper_test.rb b/test/unit/helpers/repository_helper_test.rb
index a1c778e88..4130d4657 100644
--- a/test/unit/helpers/repository_helper_test.rb
+++ b/test/unit/helpers/repository_helper_test.rb
@@ -100,4 +100,17 @@ class RepositoryHelperTest < HelperTestCase
assert_equal "Texte encod? en ISO-8859-1.", str
end
end
+
+ def test_to_utf8_invalid_utf8_sequences_should_be_stripped_ja_jis
+ with_settings :repositories_encodings => 'ISO-2022-JP' do
+ s1 = "test\xb5\xfetest\xb5\xfe"
+ s1.force_encoding("ASCII-8BIT") if s1.respond_to?(:force_encoding)
+ str = to_utf8(s1)
+ if str.respond_to?(:force_encoding)
+ assert str.valid_encoding?
+ assert_equal "UTF-8", str.encoding.to_s
+ end
+ assert_equal "test??test??", str
+ end
+ end
end