diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-02-22 13:39:12 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-02-22 13:39:12 +0000 |
commit | 9f50e6358371b60fab4245c956f02b1ae6490b56 (patch) | |
tree | 77ad494db51f53e1ac0415aae9bf45dab653b43e /test/unit/changeset_test.rb | |
parent | 4257b1d9adbcdc277ce29562dd9d879473ffa4c2 (diff) | |
download | redmine-9f50e6358371b60fab4245c956f02b1ae6490b56.tar.gz redmine-9f50e6358371b60fab4245c956f02b1ae6490b56.zip |
scm: Ruby 1.9 compatibility for log.
Remove assuming UTF-8 is valid.
"\xC2\x80" of latin-1(iso-8859-1) is valid sequence of UTF-8.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4925 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/changeset_test.rb')
-rw-r--r-- | test/unit/changeset_test.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/unit/changeset_test.rb b/test/unit/changeset_test.rb index cb4d64042..508294fea 100644 --- a/test/unit/changeset_test.rb +++ b/test/unit/changeset_test.rb @@ -221,6 +221,25 @@ class ChangesetTest < ActiveSupport::TestCase end end + def test_comments_should_be_converted_all_latin1_to_utf8 + with_settings :commit_logs_encoding => 'ISO-8859-1' do + c = Changeset.new + s1 = "\xC2\x80" + s2 = "\xc3\x82\xc2\x80" + if s1.respond_to?(:force_encoding) + s3 = s1 + s4 = s2 + s1.force_encoding('ASCII-8BIT') + s2.force_encoding('ASCII-8BIT') + s3.force_encoding('ISO-8859-1') + s4.force_encoding('UTF-8') + assert_equal s3.encode('UTF-8'), s4 + end + c.comments = s1 + assert_equal s2, c.comments + end + end + def test_identifier c = Changeset.find_by_revision('1') assert_equal c.revision, c.identifier |