@@ -232,7 +232,9 class ChangesetTest < ActiveSupport::TestCase | |||||
232 |
|
232 | |||
233 | def test_comments_should_be_converted_to_utf8 |
|
233 | def test_comments_should_be_converted_to_utf8 | |
234 | proj = Project.find(3) |
|
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 | r = Repository::Bazaar.create!( |
|
238 | r = Repository::Bazaar.create!( | |
237 | :project => proj, :url => '/tmp/test/bazaar', |
|
239 | :project => proj, :url => '/tmp/test/bazaar', | |
238 | :log_encoding => 'ISO-8859-1' ) |
|
240 | :log_encoding => 'ISO-8859-1' ) | |
@@ -243,12 +245,16 class ChangesetTest < ActiveSupport::TestCase | |||||
243 | :scmid => '12345', |
|
245 | :scmid => '12345', | |
244 | :comments => str) |
|
246 | :comments => str) | |
245 | assert( c.save ) |
|
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 | end |
|
251 | end | |
248 |
|
252 | |||
249 | def test_invalid_utf8_sequences_in_comments_should_be_stripped |
|
253 | def test_invalid_utf8_sequences_in_comments_should_be_stripped | |
250 | proj = Project.find(3) |
|
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 | r = Repository::Bazaar.create!( |
|
258 | r = Repository::Bazaar.create!( | |
253 | :project => proj, :url => '/tmp/test/bazaar', |
|
259 | :project => proj, :url => '/tmp/test/bazaar', | |
254 | :log_encoding => 'UTF-8' ) |
|
260 | :log_encoding => 'UTF-8' ) |
General Comments 0
You need to be logged in to leave comments.
Login now