ZF-3141: Zend_Translate CSV adapter is not RFC 4180 compliant

Description

The CSV file format is specified in RFC 4180 "Common Format and MIME Type for CSV Files". ( http://tools.ietf.org/html/rfc4180 )

This format specifies that to use the separator character in values, the values must be surrounded by double quotes (double quotes in the value must be included by doubling the double-quote character). However, the Zend_Translate CSV adapter is not compatible with such files.

As a result, CSV files edited with Excel are not compatible with the CSV adapter, severely decreasing its applicability.

Comments

The CSV adapter was never intended to be RFCxxx compilant so this is not a bug but a feature enhancement.

Also RFC's are no standards, they are informational drafts which will lead to a standard. Until now such a standard has not been defined.

Please give an example file where you see problems... Until now all CSV files worked, even from Excel 2003 which I worked with.

I produced a file in Excel 2003. First column "FOO1", second column "Foo,;"1" (without the surrounding quotes).

This file when opened in notepad looks like this:



Outputting a translation from php with this code:

require_once("Zend/Translate.php"); $translate = new Zend_Translate("csv", "translation.csv", "en", array('separator' => ';')); echo $translate->_("FOO1");



On screen I get:

While I expect: ```

Attached you'll find the CSV file and PHP script.

Integrated with r9585

Updating for the 1.6.0 release.