Index: node_import.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/node_import/Attic/node_import.module,v
retrieving revision 1.50.2.3.2.5
diff -b -u -r1.50.2.3.2.5 node_import.module
--- node_import.module	2 Jul 2007 09:43:24 -0000	1.50.2.3.2.5
+++ node_import.module	11 Jul 2007 10:42:07 -0000
@@ -780,7 +780,42 @@
     $handle = fopen($filepath, 'r');
   }
 
-  return fgetcsv($handle, $size, $separator);
+  return _node_import_fgetcsv($handle, $size, $separator);
+}
+
+/**
+ * fgetcsv() is buggy with special chars at the beginning of fields,
+ * let's create our own fgetcsv().
+ *
+ * main code taken from http://de.php.net/manual/en/function.fgetcsv.php#75332
+ * function changed to have a prototype like fgetcvs() and not take
+ * a string parameter
+ */
+function _node_import_fgetcsv($handle, $length, $delimiter = ',', $qualifier = '"', $qualifierEscape = '\\') {
+  $str = fgets($handle, $length);
+
+  $fields = array();
+  while (strlen($str) > 0) {
+    if ($str{0} == $delimiter) $str = substr($str, 1);
+    if ($str{0} == $qualifier) {
+      $value = '';
+      for ($i = 1; $i < strlen($str); $i++) {
+        if (($str{$i} == $qualifier) && ($str{$i-1} != $qualifierEscape)) {
+          $str = substr($str, (strlen($value) + 2));
+          $value = str_replace(($qualifierEscape.$qualifier), $qualifier, $value);
+          break;
+        }
+        $value .= $str{$i};
+      }
+    }
+    else {
+      $end = strpos($str, $delimiter);
+      $value = ($end !== false) ? substr($str, 0, $end) : $str;
+      $str = substr($str, strlen($value));
+    }
+    $fields[] = $value;
+  }
+  return $fields;
 }
 
 /**
