Forum: Ruby Re: Q about the FasterCSV

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6087a044557d6b59ab52e7dd20f94da8?d=identicon&s=25 Peña, Botp (Guest)
on 2006-04-27 08:37
(Received via mailing list)
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.
0b561a629b87f0bbf71b45ee5a48febb?d=identicon&s=25 Dave Burt (Guest)
on 2006-04-27 09:01
(Received via mailing list)
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
This topic is locked and can not be replied to.