summaryrefslogtreecommitdiff
path: root/test/csv
diff options
context:
space:
mode:
Diffstat (limited to 'test/csv')
-rw-r--r--test/csv/test_encodings.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/csv/test_encodings.rb b/test/csv/test_encodings.rb
index 8d7de2e..8470286 100644
--- a/test/csv/test_encodings.rb
+++ b/test/csv/test_encodings.rb
@@ -225,6 +225,14 @@ class TestEncodings < Test::Unit::TestCase
assert_equal("UTF-8", data.join.encoding.name)
assert_equal("UTF-8", data.to_csv.encoding.name)
end
+
+ def test_encoding_is_upgraded_for_ascii_content_during_writing_as_needed
+ data = ["foo".force_encoding("ISO-8859-1"), "\u3042"]
+ assert_equal("ISO-8859-1", data.first.encoding.name)
+ assert_equal("UTF-8", data.last.encoding.name)
+ assert_equal("UTF-8", data.join.encoding.name)
+ assert_equal("UTF-8", data.to_csv.encoding.name)
+ end
private