|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-02-10 02:15 UTC] felipe@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 14 22:00:01 2025 UTC |
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