ID: 31740 Updated by: [EMAIL PROTECTED] Reported By: arjan at avoid dot org -Status: Open +Status: Feedback Bug Type: Filesystem function related Operating System: Linux (Suse) PHP Version: 5.0.3 New Comment:
What locale specifier is set to LANG or LC_CTYPE environment variable? Previous Comments: ------------------------------------------------------------------------ [2005-01-28 20:28:51] arjan at avoid dot org In order to narrow the problem down as much as I can, I tried the following script as well on the system that have problems with fgetcsv: <?php $fp = fopen('csv_test.csv', 'r'); while (!feof($fp)) { $buffer = fgets($fp, 4096); echo $buffer; } fclose($fp); ?> In this case, the umlauts do get read and printed. ------------------------------------------------------------------------ [2005-01-28 19:37:55] arjan at avoid dot org Tested the same script on another machine (Suse 9.0), with PHP5.0.3 installed: problem does not occur here. We have two (identically installed) machines on which this bug does occur though. Can anyone point us in some direction as to what might cause this peculiar behaviour? ------------------------------------------------------------------------ [2005-01-28 12:52:34] arjan at avoid dot org Description: ------------ fgetcsv on PHP5.0.3 has problems with reading CSV-fields that start with an umlaut character (possibly other 'weird' characters as well). It simply skips those characters. PHP4.3.10 works fine. Reproduce code: --------------- csv_test.php: <?php $fp = fopen('csv_test.csv', 'r'); while($data = fgetcsv($fp, 2000, ';', '"')) { var_dump($data); } fclose($fp); ?> csv_test.csv: language_name;country_name Deutsch;Österreich Nederlands;Nederland Deutsch;Deutßland Ünited Kingdom Expected result: ---------------- array(2) { [0]=> string(13) "language_name" [1]=> string(12) "country_name" } array(2) { [0]=> string(7) "Deutsch" [1]=> string(9) "Österreich" } array(2) { [0]=> string(10) "Nederlands" [1]=> string(9) "Nederland" } array(2) { [0]=> string(7) "Deutsch" [1]=> string(9) "Deutßland" } array(1) { [0]=> string(13) "Ünited Kingdom" } Actual result: -------------- array(2) { [0]=> string(13) "language_name" [1]=> string(12) "country_name" } array(2) { [0]=> string(7) "Deutsch" [1]=> string(9) "sterreich" } array(2) { [0]=> string(10) "Nederlands" [1]=> string(9) "Nederland" } array(2) { [0]=> string(7) "Deutsch" [1]=> string(9) "Deutßland" } array(1) { [0]=> string(13) "nited Kingdom" } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31740&edit=1