From: arjan at avoid dot org
Operating system: Linux (Suse)
PHP version: 5.0.3
PHP Bug Type: Filesystem function related
Bug description: fgetcsv skips fields that start with an umlaut character
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 bug report at http://bugs.php.net/?id=31740&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31740&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=31740&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=31740&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31740&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31740&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31740&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31740&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31740&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31740&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31740&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=31740&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=31740&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31740&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31740&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31740&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31740&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31740&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31740&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31740&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31740&r=mysqlcfg