summaryrefslogtreecommitdiff
path: root/test/csv/test_encodings.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/csv/test_encodings.rb')
-rwxr-xr-xtest/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 21b997c9ec4..dc45692ce48 100755
--- a/test/csv/test_encodings.rb
+++ b/test/csv/test_encodings.rb
@@ -247,6 +247,14 @@ class TestCSV::Encodings < TestCSV
assert_equal("UTF-8", data.to_csv.encoding.name)
end
+ def test_explicit_encoding
+ bug9766 = '[ruby-core:62113] [Bug #9766]'
+ s = CSV.generate(encoding: "Windows-31J") do |csv|
+ csv << ["foo".force_encoding("ISO-8859-1"), "\u3042"]
+ end
+ assert_equal(["foo,\u3042\n".encode(Encoding::Windows_31J), Encoding::Windows_31J], [s, s.encoding], bug9766)
+ end
+
private
def assert_parses(fields, encoding, options = { })