Actions
Bug #4041
closedArray#to_csv generates invalid US-ASCII string
Description
=begin
I found Array#to_csv method generates a string with invalid encoding.
% ./ruby -rcsv -ve '
a = ["foo".force_encoding("US-ASCII"), "\u3042"]
p a.map {|v| v.encoding }
s = a.to_csv
p s
p s.encoding'
ruby 1.9.3dev (2010-11-10 trunk 29738) [i686-linux]
[#Encoding:US-ASCII, #Encoding:UTF-8]
"foo,\xE3\x81\x82\n"
#Encoding:US-ASCII
The array to convert to CSV using Array#to_csv contains US-ASCII string and
UTF-8 string.
But the result is US-ASCII string which contains 8-bit bytes.
I think the result should be UTF-8 string.¶
Tanaka Akira
=end
Actions
Like0
Like0Like0Like0