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.
Peña, Botp (Guest)
on 2006-04-28 06:39
(Received via mailing list)
Dave B. [mailto:removed_email_address@domain.invalid] :

# Oh, I don't want the patch. It's a terrible idea! "foo, bar, 'baz'"
# aren't CSV, they're CASWSSV (comma and some white-space separated
# values). That's got to be a whole new library :)

as long as the values are bounded by a comma, then they are csv
delimited. space is a value, right?

eg

   "foo, bar, 'baz'", foo, "bar" , foo"bar", foo'bar'

can be parsed as (by the eye as of the moment):

   ["foo, bar, 'baz'"," foo"," \"bar\" "," foo\"bar\""," foo'bar'"]

maybe, this can be a nice little rubyquiz?

not all data is perfect, that is why there are rubyists like Dave and
James :)

thanks and kind regards -botp
James G. (Guest)
on 2006-04-28 08:03
(Received via mailing list)
On Apr 27, 2006, at 9:36 PM, Peña, Botp wrote:

> as long as the values are bounded by a comma, then they are csv
> delimited. space is a value, right?

There's no problem with the space, correct.  The quote after it is
what makes the document illegal.  You always have to escape the
escape character, and that's the quote.  To do that, a field must
begin with a quote...

What's the correct way to handle:

one, "two"

?  Is the second field two or "two" or <space>"two".  I have no
idea.  I do know that it is invalid CSV though.  ;)

James Edward G. II
This topic is locked and can not be replied to.