|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-10-06 10:29 UTC] gruszczol1 at poczta dot onet dot pl
Description: ------------ fgetcsv() doesn't read foreign chracters which are on the beginning of the field. Similar bug in http://bugs.php.net/bug.php?id=10896 but it has status closed. Reproduce code: --------------- File contains: ?abc|?abc|?abc? Example code: $aqq=fgetcsv($fp, 4000, "|"); echo $aqq[0].$aqq[1].$aqq[2]; Expected result: ---------------- Expected result: ?abc?abc?abc? Actual result: -------------- Actual result: abcabcabc? PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 09:00:01 2025 UTC |
it looks that fgetcsv depends on locales <?php $argv[1] = './x.txt'; if (!($fd = fopen($argv[1], 'r'))) die('Can\'t open file'); while (!feof($fd)) echo fgets($fd, 4096); fclose($fd); if (!($fd = fopen($argv[1], 'r'))) die('Can\'t open file'); while (($l = fgetcsv($fd, 4096, "\t"))) print_r($l); fclose($fd); ?> x.txt get here http://lampa.naut.cz/x.txt (text contains text windows-1250 encoding "aa?\t?vvv" \t is TAB) result when locale POSIX: aa? ?vvv Array ( [0] => aa? [1] => vvv ) result when locale cs_CZ: aa? ?vvv Array ( [0] => aa? [1] => ?vvv )