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

Reply via email to