@@ -232,7 +232,9 class ChangesetTest < ActiveSupport::TestCase | |||
|
232 | 232 | |
|
233 | 233 | def test_comments_should_be_converted_to_utf8 |
|
234 | 234 | proj = Project.find(3) |
|
235 | str = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt") | |
|
235 | # str = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt") | |
|
236 | str = "Texte encod\xe9 en ISO-8859-1." | |
|
237 | str.force_encoding("ASCII-8BIT") if str.respond_to?(:force_encoding) | |
|
236 | 238 | r = Repository::Bazaar.create!( |
|
237 | 239 | :project => proj, :url => '/tmp/test/bazaar', |
|
238 | 240 | :log_encoding => 'ISO-8859-1' ) |
@@ -243,12 +245,16 class ChangesetTest < ActiveSupport::TestCase | |||
|
243 | 245 | :scmid => '12345', |
|
244 | 246 | :comments => str) |
|
245 | 247 | assert( c.save ) |
|
246 |
|
|
|
248 | str_utf8 = "Texte encod\xc3\xa9 en ISO-8859-1." | |
|
249 | str_utf8.force_encoding("UTF-8") if str_utf8.respond_to?(:force_encoding) | |
|
250 | assert_equal str_utf8, c.comments | |
|
247 | 251 | end |
|
248 | 252 | |
|
249 | 253 | def test_invalid_utf8_sequences_in_comments_should_be_stripped |
|
250 | 254 | proj = Project.find(3) |
|
251 | str = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt") | |
|
255 | # str = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt") | |
|
256 | str = "Texte encod\xe9 en ISO-8859-1." | |
|
257 | str.force_encoding("ASCII-8BIT") if str.respond_to?(:force_encoding) | |
|
252 | 258 | r = Repository::Bazaar.create!( |
|
253 | 259 | :project => proj, :url => '/tmp/test/bazaar', |
|
254 | 260 | :log_encoding => 'UTF-8' ) |
General Comments 0
You need to be logged in to leave comments.
Login now