Zend Framework

Zend_Translate CSV adapter is not RFC 4180 compliant

Details

  • Type: New Feature New Feature
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.5.1
  • Fix Version/s: 1.6.0
  • Component/s: Zend_Translate
  • Labels:
    None

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.

Activity

Hide
Thomas Weidner added a comment -

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.

Show
Thomas Weidner added a comment - 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.
Hide
Thomas Weidner added a comment -

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

Show
Thomas Weidner added a comment - Please give an example file where you see problems... Until now all CSV files worked, even from Excel 2003 which I worked with.
Hide
Joeri Sebrechts added a comment -

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:

FOO1;"Foo,;""1"

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:

"Foo,""1"

While I expect:

Foo,;"1

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

Show
Joeri Sebrechts added a comment - 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:
FOO1;"Foo,;""1"
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:
"Foo,""1"
While I expect:
Foo,;"1
Attached you'll find the CSV file and PHP script.
Hide
Thomas Weidner added a comment -

Integrated with r9585

Show
Thomas Weidner added a comment - Integrated with r9585
Hide
Wil Sinclair added a comment -

Updating for the 1.6.0 release.

Show
Wil Sinclair added a comment - Updating for the 1.6.0 release.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
Not Specified
Original Estimate - Not Specified
Remaining:
0m
Remaining Estimate - 0 minutes
Logged:
6h
Time Spent - 6 hours