summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorjeg2 <jeg2@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-17 15:03:25 +0000
committerjeg2 <jeg2@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-17 15:03:25 +0000
commitb028e8d45d90bec5ee5bcc9c4e42adc96f5d6f14 (patch)
tree08e8078c75f1a5082c33554ebe5f0492df9cbb8a /test
parent7afe174b9e7a4c977df77163ffdfae98090371a3 (diff)
* lib/csv.rb: Upgrading output encoding with ASCII content
as needed. [ruby-core:33229] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-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