ID: 48507 Comment by: dmulryan at calendarwiz dot com Reported By: krynble at yahoo dot com dot br Status: Verified Bug Type: Filesystem function related Operating System: Unix PHP Version: 5.2.9 New Comment:
Similar problem when parsing the following line: 0909211132,1,ØÊááàÑ,äÆæç,CForm,Y,1,1,1,97.95.176.240,2530 which produces empty array elements for fields with special characters: Array ( [0] => 0909211132 [1] => 1 [2] => [3] => [4] => URL [5] => Y [6] => 1 [7] => 1 [8] => 1 [9] => 97.95.176.240 [10] => 2530 ) Previous Comments: ------------------------------------------------------------------------ [2009-06-26 19:35:22] sjoerd-php at linuxonly dot nl Could reproduce with php 5.2.10, php 5.2.11-dev (200906261830) and php 5.3rc4. Example code: <?php $fp = tmpfile(); $str = "WEIRD#\xD3TICA#BEHAVIOR"; fwrite($fp, $str); fseek($fp, 0); $arr = fgetcsv($fp, 100, '#'); var_dump($arr[1]); fclose($fp); ?> Expected: string(5) "?TICA" Actual: string(4) "TICA" ------------------------------------------------------------------------ [2009-06-13 18:10:03] krynble at yahoo dot com dot br Unfortunately I'm unable to test it because the server is running in a Datacenter. If someone can give a feedback about it, I would apreciate. Still, thanks for the help! ------------------------------------------------------------------------ [2009-06-10 12:47:52] j...@php.net Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://windows.php.net/snapshots/ ------------------------------------------------------------------------ [2009-06-09 14:18:39] krynble at yahoo dot com dot br Description: ------------ Problem using fgetcsv ignoring special characters at the begining of a string. The example I had was using the word "ÓTICA" with the "#" character as separator. Reproduce code: --------------- Consider a file with the following contents: WEIRD#ÓTICA#BEHAVIOR When using fgetcsv to parse this file, I get an output like this: Array( [0] => WEIRD, [1] => TICA, [2] => BEHAVIOR ) Expected result: ---------------- Array( [0] => WEIRD, [1] => ÓTICA, [2] => BEHAVIOR ) Actual result: -------------- Array( [0] => WEIRD, [1] => TICA, [2] => BEHAVIOR ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48507&edit=1