Bug #50686 [Com]: fputcsv and fgetcsv doesn't follow CSV format
| From: | myfordbenefits dot cc at gmail dot com | Date: | Wed, 13 Jul 2022 07:24:00 +0000 |
| Subject: | Bug #50686 [Com]: fputcsv and fgetcsv doesn't follow CSV format | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-241917@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=50686&edit=1
ID: 50686
Comment by: myfordbenefits dot cc at gmail dot com
Reported by: thuejk at gmail dot com
Summary: fputcsv and fgetcsv doesn't follow CSV format
Status: Wont fix
Type: Bug
Package: Filesystem function related
Operating System: *
PHP Version: 5.*, 6
Assigned To: iliaa
Block user comment: N
Private report: N
New Comment:
Facing same issue here. Help is appreciated. Thanks for the info i will try to figure it out for
more. <a href="">myfordbenefits</a>
.
Previous Comments:
------------------------------------------------------------------------
[2019-10-17 14:11:25] bugreports at gmail dot com
what would you gain by deprecate it?
it only would bring users using it for their workloads for 15 years without any issue in trouble and
you still won#t have something mathcing your needs
------------------------------------------------------------------------
[2019-10-17 14:04:45] durinf at gmail dot com
Hey, if ya'll are too lazy to fix this, how about at least deprecating it?
Sheesh.
------------------------------------------------------------------------
[2017-04-11 18:43:49] plenty dot su at gmail dot com
I mentioned in: https://bugs.php.net/bug.php?id=43225
A workaround so far is to disable escape method by: fputcsv($handle, $array, ',',
'"', "\0")
------------------------------------------------------------------------
[2017-02-09 17:03:49] aleksey dot spec at gmail dot com
Please, change the behaviour or provide another function. We have problems while preparing csv-files
for ClickHouse.
When I write
$string = '\\"';
fputcsv($fileHandle, [$string]);
I expect to see this in my file:
"\"""
but currently I see
"\""
Csv is often used for communications between different environments, not only inside php with
fputcsv/fgetcsv. so it would be much better if generated csv file obeys some commonly used standard
like RFC 4180.
P.S. Please, do not take personally. I really love php and I'd like it to become even more
beautiful and popular.
------------------------------------------------------------------------
[2016-09-23 17:17:15] office at williamhollandschool dot com
I see that the versions entry only lists 5.* and 6. I use PHP 7 and the "escape" character
thing has caused me no end of grief in trying to implement import and export of natural language
documents into and out of CSV format to later be interpreted by MariaDB's LOAD INFILE. Even
trying the workaround that's posted everywhere of putting the "escape" character the
same as the enclosure character only caused it to fail to escape any enclosure characters. Having to
generate then fix giant files by hand is what has driven me to Python for this task. Many, many
things are still using CSV. Not the most important bug in PHP 7, but one that has annoyed me to no
end.
------------------------------------------------------------------------
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
https://bugs.php.net/bug.php?id=50686
--
Edit this bug report at https://bugs.php.net/bug.php?id=50686&edit=1