ID:               27082
 Updated by:       [EMAIL PROTECTED]
 Reported By:      christian at wenz dot org
-Status:           Open
+Status:           Closed
 Bug Type:         Filesystem function related
 Operating System: Windows XP
 PHP Version:      4.3.5RC1
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------

[2004-01-29 06:28:50] christian at wenz dot org

Description:
------------
According to the CSV spec at http://rath.ca/Misc/Perl_CSV/CSV-2.0.html
, quotes within CSV files can be escaped by "doubling" the quotes. So
if you have a CSV file with two values:
  I think this "IS" a bug
  another value
then the CSV file would look like this:
"I think this ""IS"" a bug",another value

However, when reading such a CSV file using fgetcsv, the doubled quotes
are not transformed into single quotes as expected. 

Reproduce code:
---------------
<?php
$fp = fopen("csv_file", "w+");
$fields = array();

$fields[0] = '"I think this ""IS"" a bug"';
$fields[1] = "another field";
fwrite($fp, implode(",", $fields));

fseek($fp, 0);
var_dump(fgetcsv($fp, 4096));
?>


Expected result:
----------------
array(2) {
  [0]=>
  string(23) "I think this "IS" a bug"
  [1]=>
  string(13) "another field"
}


Actual result:
--------------
array(2) {
  [0]=>
  string(25) "I think this ""IS"" a bug"
  [1]=>
  string(13) "another field"
}



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=27082&edit=1

Reply via email to