#30335 [Com]: fgetcsv + foreign characters

From: Date: Fri, 11 Nov 2005 12:53:05 +0000
Subject: #30335 [Com]: fgetcsv + foreign characters
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-88038@lists.php.net to get a copy of this message
ID: 30335 Comment by: mdv at inyourpocket dot com Reported By: gruszczol1 at poczta dot onet dot pl Status: No Feedback Bug Type: Filesystem function related Operating System: linux PHP Version: 5.0.2 New Comment: i tested in on php 5.0.5 Previous Comments: ------------------------------------------------------------------------ [2005-11-11 13:49:51] mdv at inyourpocket dot com 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 ) ------------------------------------------------------------------------ [2004-10-16 01:00:02] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2004-10-07 17:15:23] moriyoshi@php.net Try setting LC_CTYPE (or LANG) environment variable to "pl_PL.ISO-8859-2". ------------------------------------------------------------------------ [2004-10-07 01:38:48] iliaa@php.net Specific to 5.X ------------------------------------------------------------------------ [2004-10-06 11:40:37] gruszczol1 at poczta dot onet dot pl It was tested with iso-8859-2 and windows-1250 text file. http://republika.pl/gruszczol1/fgetcsv_bug_example.tgz ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/30335 -- Edit this bug report at http://bugs.php.net/?id=30335&edit=1

« previous php.bugs (#88038) next »