Bug #4063
closedArray#to_csv(ascii-subset-of-iso-8859-1, utf-8)
Description
=begin
Array#to_csv still has an encoding problem.
% ./ruby -rcsv -ve '
a = ["foo".force_encoding("ISO-8859-1"), "\u3042"]
puts a[0].dump
puts a[1].dump
p a.map {|v| v.encoding }
s = a.to_csv
puts s.dump
p s.encoding'
ruby 1.9.3dev (2010-11-17 trunk 29809) [i686-linux]
"foo"
"\u{3042}"
[#Encoding:ISO-8859-1, #Encoding:UTF-8]
"foo,\xE3\x81\x82\n"
#Encoding:ISO-8859-1
The encoding of the first string is ISO-8859-1 but
contains only ASCII characters.
The encoding of the second string is UTF-8 and
contains a UTF-8 (non-ASCII, non-ISO-8859-1) character.
(The character U+3042 is HIRAGANA LETTER A.)
The encoding of the result of Array#to_csv is ISO-8859-1 but
it contains the bytes of HIRAGANA LETTER A in UTF-8.
Tanaka Akira
=end
Updated by JEG2 (James Gray) almost 14 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r29822.
Akira, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end