From: Tanaka Akira Date: 2010-11-17T11:42:01+09:00 Subject: [ruby-core:33229] [bug:trunk] Array#to_csv(ascii-subset-of-iso-8859-1, utf-8) 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}" [#, #] "foo,\xE3\x81\x82\n" # 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