#31740 [Opn]: fgetcsv skips fields that start with an umlaut character
| From: | arjan at avoid dot org | Date: | Fri, 28 Jan 2005 18:37:56 +0000 |
| Subject: | #31740 [Opn]: fgetcsv skips fields that start with an umlaut character | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-72997@lists.php.net to get a copy of this message | ||
ID: 31740
User updated by: arjan at avoid dot org
Reported By: arjan at avoid dot org
Status: Open
Bug Type: Filesystem function related
Operating System: Linux (Suse)
PHP Version: 5.0.3
New Comment:
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?
Previous Comments:
------------------------------------------------------------------------
[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