#42163 [Opn->Csd]: fgetcsv() gives different output with and without Unicode
| From: | felipe@php.net | Date: | Sun, 10 Feb 2008 02:15:15 +0000 |
| Subject: | #42163 [Opn->Csd]: fgetcsv() gives different output with and without Unicode | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-122136@lists.php.net to get a copy of this message | ||
ID: 42163
Updated by: felipe@php.net
Reported By: nikhil dot gupta at in dot ibm dot com
-Status: Open
+Status: Closed
Bug Type: *Unicode Issues
Operating System: Linux, Win32-xp
PHP Version: 6CVS-2007-08-01 (snap)
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:
------------------------------------------------------------------------
[2007-08-01 08:43:33] nikhil dot gupta at in dot ibm dot com
Description:
------------
fgetcsv() outputs different results with and without Unicode on Windows
and Linux.
Reproduce code:
---------------
--TEST--
Test fgetcsv()
--FILE--
<?php
$filename = dirname(__FILE__) . '/fgetcsv.tmp';
// create the file and add the content with has csv fields
$file_handle = fopen($filename, "w+t" );
$delimiter = '-';
$enclosure = '-';
$csv_field = '-water---fruit---air-';
@fwrite($file_handle, $csv_field );
// rewind the file pointer to bof
rewind($file_handle);
// use the right delimiter and enclosure with max length
var_dump( fgetcsv($file_handle, 1024, $delimiter, $enclosure) );
// close the file
fclose($file_handle);
//delete file
unlink($filename);
echo "Done\n";
?>
--EXPECT--
Expected result:
----------------
array(2) {
[0]=>
string(11) "water-fruit"
[1]=>
string(3) "air"
}
Done
Actual result:
--------------
array(1) {
[0]=>
unicode(12) "wat^@^@^@fruitt"
}
Done
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42163&edit=1