Parsing complicated CSV file with sed

Yes, there is a great doc out there that discusses parsing csv files with sed, and this topic has been covered before but not enough to answer my question (unix.com forums).

I'm trying to parse a CSV file that has optional quotes like the following:

"Apple","Apples, are fun",3.60,4.4,"I like eating apples, nuts and candies."
"Cucumber","How long is it?',6.0,3,"Pickles are cucumbers."

I'm about to give up and write my own program, whose algorithm would go something like this:

grab char
If char = "
  grab next char
  If char = comma remove
  else if char = " grab next char = , and end column 
  else echo char
else 
  If char = comma end column
  else echo char
  grab next char
end

Seems like it is a pretty simple algorithm, someone should be able to do this with a sed script?

does it have to be done in 'sed'?
how 'bout this thread?

Assuming (from analyzing your test data) that only commas used within strings are followed by blanks, the following substitutes thus separates field separators from ordinary punctation marks:

[house@leonov] cat test.file | tr "," ";" | sed 's/; /, /g'
"Apple";"Apples, are fun";3.60;4.4;"I like eating apples, nuts and candies."
"Cucumber";"How long is it?';6.0;3;"Pickles are cucumbers."

If this were my script, however, I'd apply the above on a line by line basis, then count the fields of the resulting line to verify it being updated successfully ... How about single vs. double quotes, by the way?

Not always a space following a comma, and single quotes are okay anywhere. I gave up and wrote it in PHP. Don't have awk installed, don't feel like installing it, plus with PHP I can do some other tasks for the procedure. This was just one step in a whole line of work that has to be done on the files.