On Tue, 9 May 2006, Eric Luo wrote:

> Why 'a,"bc"d' could not be parsed correctly in both FasterCSV and CSV
> libary. while
> "a,'bc'd" could be parsed into [["a", "'bc'd"]] successfully.

it's malformed.  it should look like this:

   jib:~ > ruby -r csv -e'  CSV::Writer::generate(STDOUT){|c| c << %w[ a "bc"d ]}  '
   a,"""bc""d"


"a,'bc'd"  is correct

   jib:~ > ruby -r csv -e"  CSV::Writer::generate(STDOUT){|c| c << %w[ a 'bc'd ]}  "
   a,'bc'd


double quotes must be escaped if they are to be within a field.

regards.

-a
-- 
be kind whenever possible... it is always possible.
- h.h. the 14th dali lama