Index: changeset_test.rb =================================================================== --- changeset_test.rb (revision 17991) +++ changeset_test.rb (working copy) @@ -448,7 +448,7 @@ def test_comments_should_be_converted_to_utf8 proj = Project.find(3) - str = (+"Texte encod\xe9 en ISO-8859-1.").force_encoding("ASCII-8BIT") + str = "Texte encod\xe9 en ISO-8859-1.".b r = Repository::Bazaar.create!( :project => proj, :url => '/tmp/test/bazaar', @@ -465,7 +465,7 @@ def test_invalid_utf8_sequences_in_comments_should_be_replaced_latin1 proj = Project.find(3) - str2 = (+"\xe9a\xe9b\xe9c\xe9d\xe9e test").force_encoding("ASCII-8BIT") + str2 = "\xe9a\xe9b\xe9c\xe9d\xe9e test".b r = Repository::Bazaar.create!( :project => proj, :url => '/tmp/test/bazaar', @@ -484,7 +484,7 @@ def test_invalid_utf8_sequences_in_comments_should_be_replaced_ja_jis proj = Project.find(3) - str = (+"test\xb5\xfetest\xb5\xfe").force_encoding('ASCII-8BIT') + str = "test\xb5\xfetest\xb5\xfe".b r = Repository::Bazaar.create!( :project => proj, :url => '/tmp/test/bazaar', @@ -504,8 +504,8 @@ s2 = +"\xc3\x82\xc2\x80" s4 = s2.dup s3 = s1.dup - s1.force_encoding('ASCII-8BIT') - s2.force_encoding('ASCII-8BIT') + s1 = s1.b + s2 = s2.b s3.force_encoding('ISO-8859-1') s4.force_encoding('UTF-8') assert_equal s3.encode('UTF-8'), s4 @@ -526,7 +526,7 @@ def test_invalid_utf8_sequences_in_paths_should_be_replaced proj = Project.find(3) - str2 = (+"\xe9a\xe9b\xe9c\xe9d\xe9e test").force_encoding("ASCII-8BIT") + str2 = "\xe9a\xe9b\xe9c\xe9d\xe9e test".b r = Repository::Bazaar.create!( :project => proj, :url => '/tmp/test/bazaar', Index: custom_field_test.rb =================================================================== --- custom_field_test.rb (revision 17991) +++ custom_field_test.rb (working copy) @@ -107,7 +107,7 @@ def test_possible_values_should_return_utf8_encoded_strings field = CustomField.new - s = (+"Value").force_encoding('BINARY') + s = "Value".b field.possible_values = s assert_equal [s], field.possible_values assert_equal 'UTF-8', field.possible_values.first.encoding.name Index: lib/redmine/codeset_util_test.rb =================================================================== --- lib/redmine/codeset_util_test.rb (revision 17991) +++ lib/redmine/codeset_util_test.rb (working copy) @@ -24,7 +24,7 @@ def test_to_utf8_by_setting_from_latin1 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do s1 = 'Texte encodé' - s2 = (+"Texte encod\xe9").force_encoding("ASCII-8BIT") + s2 = "Texte encod\xe9".b s3 = s2.dup.force_encoding("UTF-8") assert_equal s1, Redmine::CodesetUtil.to_utf8_by_setting(s2) assert_equal s1, Redmine::CodesetUtil.to_utf8_by_setting(s3) @@ -34,7 +34,7 @@ def test_to_utf8_by_setting_from_euc_jp with_settings :repositories_encodings => 'UTF-8,EUC-JP' do s1 = 'レッドマイン' - s2 = (+"\xa5\xec\xa5\xc3\xa5\xc9\xa5\xde\xa5\xa4\xa5\xf3").force_encoding("ASCII-8BIT") + s2 = "\xa5\xec\xa5\xc3\xa5\xc9\xa5\xde\xa5\xa4\xa5\xf3".b s3 = s2.dup.force_encoding("UTF-8") assert_equal s1, Redmine::CodesetUtil.to_utf8_by_setting(s2) assert_equal s1, Redmine::CodesetUtil.to_utf8_by_setting(s3) @@ -44,7 +44,7 @@ def test_to_utf8_by_setting_should_be_converted_all_latin1 with_settings :repositories_encodings => 'ISO-8859-1' do s1 = "Â\u0080" - s2 = (+"\xC2\x80").force_encoding("ASCII-8BIT") + s2 = "\xC2\x80".b s3 = s2.dup.force_encoding("UTF-8") assert_equal s1, Redmine::CodesetUtil.to_utf8_by_setting(s2) assert_equal s1, Redmine::CodesetUtil.to_utf8_by_setting(s3) @@ -69,7 +69,7 @@ def test_to_utf8_by_setting_invalid_utf8_sequences_should_be_stripped with_settings :repositories_encodings => '' do - s1 = (+"Texte encod\xe9 en ISO-8859-1.").force_encoding("ASCII-8BIT") + s1 = "Texte encod\xe9 en ISO-8859-1.".b str = Redmine::CodesetUtil.to_utf8_by_setting(s1) assert str.valid_encoding? assert_equal "UTF-8", str.encoding.to_s @@ -79,7 +79,7 @@ def test_to_utf8_by_setting_invalid_utf8_sequences_should_be_stripped_ja_jis with_settings :repositories_encodings => 'ISO-2022-JP' do - s1 = (+"test\xb5\xfetest\xb5\xfe").force_encoding("ASCII-8BIT") + s1 = "test\xb5\xfetest\xb5\xfe".b str = Redmine::CodesetUtil.to_utf8_by_setting(s1) assert str.valid_encoding? assert_equal "UTF-8", str.encoding.to_s Index: lib/redmine/export/pdf_test.rb =================================================================== --- lib/redmine/export/pdf_test.rb (revision 17991) +++ lib/redmine/export/pdf_test.rb (working copy) @@ -36,9 +36,9 @@ txt_1 = Redmine::Export::PDF::RDMPdfEncoding::rdm_from_utf8(utf8_txt_1, encoding) txt_2 = Redmine::Export::PDF::RDMPdfEncoding::rdm_from_utf8(utf8_txt_2, encoding) txt_3 = Redmine::Export::PDF::RDMPdfEncoding::rdm_from_utf8(utf8_txt_3, encoding) - assert_equal (+"?\x91\xd4").force_encoding("ASCII-8BIT"), txt_1 - assert_equal (+"?\x91\xd4?").force_encoding("ASCII-8BIT"), txt_2 - assert_equal (+"??\x91\xd4?").force_encoding("ASCII-8BIT"), txt_3 + assert_equal "?\x91\xd4".b, txt_1 + assert_equal "?\x91\xd4?".b, txt_2 + assert_equal "??\x91\xd4?".b, txt_3 assert_equal "ASCII-8BIT", txt_1.encoding.to_s assert_equal "ASCII-8BIT", txt_2.encoding.to_s assert_equal "ASCII-8BIT", txt_3.encoding.to_s @@ -47,7 +47,7 @@ def test_rdm_pdf_iconv_invalid_utf8_should_be_replaced_en str1 = "Texte encod\xE9 en ISO-8859-1" - str2 = (+"\xe9a\xe9b\xe9c\xe9d\xe9e test").force_encoding("ASCII-8BIT") + str2 = "\xe9a\xe9b\xe9c\xe9d\xe9e test".b txt_1 = Redmine::Export::PDF::RDMPdfEncoding::rdm_from_utf8(str1, 'UTF-8') txt_2 = Redmine::Export::PDF::RDMPdfEncoding::rdm_from_utf8(str2, 'UTF-8') assert_equal "ASCII-8BIT", txt_1.encoding.to_s @@ -58,7 +58,7 @@ def test_rdm_pdf_iconv_invalid_utf8_should_be_replaced_ja str1 = "Texte encod\xE9 en ISO-8859-1" - str2 = (+"\xe9a\xe9b\xe9c\xe9d\xe9e test").force_encoding("ASCII-8BIT") + str2 = "\xe9a\xe9b\xe9c\xe9d\xe9e test".b encoding = ( RUBY_PLATFORM == 'java' ? "SJIS" : "CP932" ) txt_1 = Redmine::Export::PDF::RDMPdfEncoding::rdm_from_utf8(str1, encoding) txt_2 = Redmine::Export::PDF::RDMPdfEncoding::rdm_from_utf8(str2, encoding) @@ -72,7 +72,7 @@ ["CP932", "SJIS"].each do |encoding| set_fixtures_attachments_directory - str2 = (+"\x83e\x83X\x83g").force_encoding("ASCII-8BIT") + str2 = "\x83e\x83X\x83g".b a1 = Attachment.find(17) a2 = Attachment.find(19) Index: lib/redmine/scm/adapters/git_adapter_test.rb =================================================================== --- lib/redmine/scm/adapters/git_adapter_test.rb (revision 17991) +++ lib/redmine/scm/adapters/git_adapter_test.rb (working copy) @@ -58,7 +58,7 @@ ) assert @adapter @char_1 = 'Ü' - @str_felix_hex = (+"Felix Sch\xC3\xA4fer").force_encoding('ASCII-8BIT') + @str_felix_hex = "Felix Sch\xC3\xA4fer".b end def test_scm_version Index: repository_bazaar_test.rb =================================================================== --- repository_bazaar_test.rb (revision 17991) +++ repository_bazaar_test.rb (working copy) @@ -47,7 +47,7 @@ Encoding.locale_charmap == "ISO-8859-1") CHAR_1_UTF8_HEX = 'Ü' - CHAR_1_LATIN1_HEX = (+"\xdc").force_encoding('ASCII-8BIT') + CHAR_1_LATIN1_HEX = "\xdc".b def setup User.current = nil