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-28 04:39
(Received via mailing list)
Dave Burt [mailto:dave@burt.id.au] :

# 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
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2006-04-28 06: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 Gray II
This topic is locked and can not be replied to.