From: "Peña, Botp" Date: 2004-05-18T13:16:16+09:00 Subject: Re: CSV bug? Nahi aka NAKAMURA, Hiroshi [mailto:nahi@keynauts.com] humbly replied: > > In particular, the CSV looks something like this: > > > > row 1, field 1, field 2\r\n > > row 2, "some\n > > text", field 2\r\n > > CSV module (of mine) just does not expect the space just after field > delimiter(,) and before quote marker("). > > 0% ruby -rcsv -e 'CSV::Reader.parse(%Q("a","b")) { |row| p > row }' ["a", "b"] 0% ruby -rcsv -e 'CSV::Reader.parse(%Q("a", > "b")) { |row| p row }' /usr/local/lib/ruby/1.9/csv.rb:557:in > `get_row': CSV::IllegalFormatError > (CSV::IllegalFormatError) > from /usr/local/lib/ruby/1.9/csv.rb:506:in `each' > from /usr/local/lib/ruby/1.9/csv.rb:484:in `parse' > from -e:1 > > Does Excel generates such a line? Hmm. It must be supported I am not SER, but I hope I can comment, too, pls. > then, even > though it could be a option. Do you expect 'a, "b"' is > parsed as > 'a,"b"', not an error, right? Yes, it must NOT be an error. You may include spaces (to be close to original), but it does not matter now (on my case only). > What do you think about > 'a,junk"b"' and Yes, we need it here. Parse it like ['a','junk"b"']. Eg, we have lines like 1;SMTP:"local;part"@test.com;x400:blahblahblah;smtp:test@test.com 2;SMTP:"local;part2"@test.com;x400:blahblahblah;smtp:test2@test.com Though my sample is ";"-delimited, I would like to get the ff result in parsing line 1 as: ['1','SMTP:"local;part"@test.com','x400:blahblahblah','smtp:test@test.com'] I really hope that is possible (I beg). > 'a,\t\r\n"b"'? > As long as the delimiter is "," , then that should be parse as ['a','\t\r\n"b"'] > Regards, > // NaHi > Thank you for your csv module. It's very helpful. btw, Who does the documentation? The doc is very sparse. I hope I can help :-( kind regards -botp