#50686 [Asn->WFx]: fputcsv and fgetcsv doesn't follow CSV format
| From: | iliaa@php.net | Date: | Mon, 11 Jan 2010 02:55:18 +0000 |
| Subject: | #50686 [Asn->WFx]: fputcsv and fgetcsv doesn't follow CSV format | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-146517@lists.php.net to get a copy of this message | ||
ID: 50686
Updated by: iliaa@php.net
Reported By: thuejk at gmail dot com
-Status: Assigned
+Status: Wont fix
Bug Type: Filesystem function related
Operating System: *
PHP Version: 5.*, 6
Assigned To: iliaa
New Comment:
The PHP's behaviour on this matter was established before the spec
written and the implementation of fgetcsv() will continue to support \
escape character.
The fputcsv() function already uses "" for escaping.
Previous Comments:
------------------------------------------------------------------------
[2010-01-10 19:21:57] thuejk at gmail dot com
I will consider doing the work to port the tests if you will commit to
actually use them.
I assume you can't change the functions (until PHP 6 at least), since
people may depend on their current behavior. So I assume you will just
add a "THIS IS NOT REALLY CSV FORMAT" warning to the manual page, and
perhaps add a strict warning when using the functions.
So I assume that any CSV functions will be new functions, which you
will have to commit to making first.
So say you will make the CSV functions (and please also make string
versions of both functions this time), then I will consider doing the
effort of porting my tests :).
------------------------------------------------------------------------
[2010-01-09 18:46:49] jani@php.net
No, you send us the tests provided as PHPTs like any other test is in
our test suite. Not the other way around.
------------------------------------------------------------------------
[2010-01-09 15:48:01] thuejk at gmail dot com
I have written a test suite (for my own local replacement functions for
fcsvget/put). So if you reimplement the PHP functions then you might
want to send me your new implementation, so I can run it through the
test suite.
------------------------------------------------------------------------
[2010-01-08 13:05:37] thuejk at gmail dot com
Also, according to RFC 4180, CSV lines should be terminated by \r\n,
not \n.
Since CSV is a data exchange format, the line termination should not be
dependent on the system generating the CSV file.
fputcsv() currently terminates CSV-lines with \n on my Linux server.
----
PS: I just noticed that RFC 4180 is from 2005, so you have some excuse,
since the PHP function predates the RFC. However, the RFC cites 4
previous non-RFC definitions, which all agree with the RFC on the
important points, so it is not clear that the PHP implementation ever
had any right to claim it had anything to do with the CSV format. And of
course at least OpenOffice's CSV-support, and probably many other
programs, can't work with the input/output of the PHP functions.
------------------------------------------------------------------------
[2010-01-07 18:42:44] jani@php.net
Ilia, maybe you want to check this out? :)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/50686
--
Edit this bug report at http://bugs.php.net/?id=50686&edit=1