note 103280 deleted from function.fgetcsv by danbrown
| From: | danbrown@php.net | Date: | Thu, 07 Apr 2011 14:30:41 +0000 |
| Subject: | note 103280 deleted from function.fgetcsv by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-178595@lists.php.net to get a copy of this message | ||
Note Submitter: Klaus
----
fgetcsv() appears to have an undocumented 5th parameter, which allows to specify an escape
character. It defaults to the backslash (\), which is actually incorrect for standard CSV.
Example:
$row = fgetcsv($fp, 4096, ',', '"', "\x00");
This allows to correctly read standard CSV files - as long as they don't contain \x00 (AFAIR,
MS Access produces CSV files where NULL values are represented by \x00). It appears that it's
impossible to fully disable the escape character, it's only possible to redefine it.
Checked with PHP 5.3.5.