note 98254 rejected from function.fgetcsv by danbrown

From: Date: Fri, 04 Jun 2010 12:55:48 +0000
Subject: note 98254 rejected from function.fgetcsv by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-169886@lists.php.net to get a copy of this message
Note Submitter: scottchu dot tw at gmail dot com ---- I read in a utf8-encoded csv file with contents as follows: "C1", "C2", "C3" "chinese string 1", number, "string 3" using following codes: setlocale(LC_ALL, 'en_US.UTF-8'); ... while (($ar = fgetcsv($fp,0,",","\"")) != false) { .... ~~~ when I read 1st row (which is the field name list) & use print_r($ar) to dump it I found 1st element of $ar is "C1" rather than C1. But other elements are ok. fgetcsv treats the enclosing double quotes as part of value. What's wrong? Is it a bug?

« previous php.notes (#169886) next »