From: James Edward Gray II Date: 2010-10-28T09:13:33+09:00 Subject: Re: FasterCSV - illegal quoting error - thought it was correct? On Oct 27, 2010, at 5:58 PM, Gabriel Saravia wrote: > I have a csv file that includes many rows here's an example snippet > including the header row: > > First Name, Last Name, Email, Password, Roles > Sophia, Jackson, sjackson@example.com, abc123, UserRole1 > Olivia, Davis, odavis@example.com, abc123, User Role2 > Alexander, Thomas, athomas@example.com, abc123, "UserRole1, User Role2" > I thought that this was the correct way to handle this situation > according to the standard. I do not want the quotes to be returned as > part of my string, i just want the string that is the user roles. One > set of quotes returns me the error illegal quoting, two sets of quotes > returns me the same error. Shouldn't three sets include the quotes as > part of the string? Well, it still returns me the same error. > > What am I doing wrong? thanks. The issue is the spaces after your commas. A quoted field must begin with a quote, not a space. Here's an example: >> require "rubygems" => true >> require "faster_csv" => true >> FCSV.parse('a, "b, c"') FasterCSV::MalformedCSVError: Illegal quoting on line 1. ... >> FCSV.parse('a,"b, c"') => [["a", "b, c"]] I hope that helps. James Edward Gray II