This is a break out of a discussion here: #376263: Make parser_csv_parse() into a parser class

We could split the CSV parsing portion of CSV Parser from the FeedAPI integration. The CSV parsing portion could live in its own Drupal-independent project as it is applicable in any PHP project. Possible infrastructure for hosting a CMS independent PHP CSV Parser would be

* Launchpad (preferred: distributed VCS, community)
* Google code
* ?

Of course this opens the question whether there's another comparable PHP CVS parser project out there that we could just use. If there isn't - I'm strongly leaning towards creating a Drupal independent project. Making the parser FeedAPI independent and Drupal independent is the way of getting more contributors onto it.

Comments

jpetso’s picture

As for the requirements on a potential replacement parser, here's the original reasoning that lead me to writing yet another parser (I included it as comment in the original parser file, need to get it included in parser_csv_parser.inc still):

// Also see http://www.rfc-editor.org/rfc/rfc4180.txt which describes the
// standardized version of the CSV format. PHP's fgetcsv() and str_getcsv()
// functions do not quite conform to that standard because they use an
// escape character ('\') instead of using a doubled double-quote ('""') for
// double-quote escapings inside a quoted field.
//
// Despite the massive amount of example CSV parsers in the PHP documentation's
// user comment section, none seem to handle this standard with all its traits
// (quote escaping, quoted fields spanning multiple lines, etc.) correctly
// and in a readable way. So here's another custom implementation. (Bah.)

The tests that already exist in parser_csv are a good start for determining standards compliance.

alex_b’s picture

jpetso just rolled out PHP-CSV: https://launchpad.net/php-csv

We're ready to break out now.