Eric Luo [mailto:eric.wenbl@gmail.com] :
# In the csv file,
# line 1,"1"
# line 2, "2"
# Is it a bug or expected?
imho, a bug.
Eric Luo [mailto:eric.wenbl@gmail.com] :
# In the csv file,
# line 1,"1"
# line 2, "2"
# Is it a bug or expected?
imho, a bug.
Peña wrote:
Eric Luo [mailto:eric.wenbl@gmail.com] :
# In the csv file,
# line 1,"1"
# line 2, "2"
# Is it a bug or expected?imho, a bug.
No, it's not a bug. CSV is a simple delimited format. It's delimited by
a comma character, not a comma then some arbitrary whitespace. That's
how Microsoft's Excel and Access and SQL Server parsers deal with it, too.
And, of course, Ruby's standard CSV library:
irb(main):001:0> require 'csv'
=> true
irb(main):002:0> CSV.parse 'line 1,"1"\nline 2, "2"\n'
CSV::IllegalFormatError: CSV::IllegalFormatError
from D:/Apps/ruby/lib/ruby/1.8/csv.rb:607:in `get_row'
from D:/Apps/ruby/lib/ruby/1.8/csv.rb:556:in `each'
from D:/Apps/ruby/lib/ruby/1.8/csv.rb:127:in `parse'
from (irb):2
Cheers,
Dave