Index: FeedsCSVParser.inc
===================================================================
--- FeedsCSVParser.inc	(revision 260)
+++ FeedsCSVParser.inc	(working copy)
@@ -8,47 +8,65 @@
  * Parses a given file as a CSV file.
  */
 class FeedsCSVParser extends FeedsParser {
+	private $position = 0;
 
   /**
    * Implementation of FeedsParser::parse().
    */
   public function parse(FeedsImportBatch $batch, FeedsSource $source) {
-
     // Load and configure parser.
-    feeds_include_library('ParserCSV.inc', 'ParserCSV');
-    $iterator = new ParserCSVIterator(realpath($batch->getFilePath()));
+    $filePath = realpath($batch->getFilePath());
     $source_config = $source->getConfigFor($this);
-    $parser = new ParserCSV();
     $delimiter = $source_config['delimiter'] == 'TAB' ? "\t" : $source_config['delimiter'];
-    $parser->setDelimiter($delimiter);
+	$seek = $batch->lastSeek;
+		
+	$handle = fopen($filePath, "r");
+	$headers = $this->getHeader($handle, $delimiter);
+	
+	if($seek > ftell($handle)){
+		fseek($handle, $seek);	//prevents us from resetting it back to 0 and re-reading the headers on the first batch
+	}
+	
+	$rows = array();
+	//read the rows
+	for($i = 0; $i < FEEDS_PARSER_CSV_BATCH_SIZE; $i++){
+		$fields = fgetcsv($handle, 0, $delimiter);
+		if($fields === FALSE || $fields === NULL){
+			continue;
+		}
+		$row = array();
+		//rename the rows so that we can match them properly
+        foreach ($headers as $columnName) {
+          $field = array_shift($fields);
+          $row[$columnName] = isset($field) ? $field : '';
+        }
+		
+		$rows[] = $row;
+	}
+	$batch->lastSeek = ftell($handle);
+	fclose($handle);
+	
+	if($batch->lastSeek >= filesize(realpath($batch->getFilePath())) && count($rows) == 0) {
+		$batch->setProgress(FEEDS_PARSING, FEEDS_BATCH_COMPLETE);
+	}else{
+		// Remember last parser position if we did not get to the end of the file.
+		$batch->setTotal(FEEDS_PARSING, filesize(realpath($batch->getFilePath())));
+		$batch->setProgress(FEEDS_PARSING, $batch->lastSeek);
+	}
 
-    // Get first line and use it for column names, convert them to lower case.
-    $parser->setLineLimit(1);
-    $rows = $parser->parse($iterator);
-    $header = array_shift($rows);
+    // Populate batch.
+    $batch->setItems($rows);
+  }
+  
+  public function getHeader($handle, $delimiter){
+	$header = fgetcsv($handle, 0, $delimiter);
+	
+	//convert to lowercase:	
     foreach ($header as $i => $title) {
       $header[$i] = trim(drupal_strtolower($title));
     }
-    $parser->setColumnNames($header);
-
-    // Set line limit to 0 and start byte to last position and parse rest.
-    // Set line limit and start byte to last position and parse rest.
-    $parser->setLineLimit(FEEDS_PARSER_CSV_BATCH_SIZE);
-    $parser->setStartByte($batch->parser_pos ? $batch->parser_pos : $parser->lastLinePos());
-    $rows = $parser->parse($iterator);
 	
-    // Remember last parser position if we did not get to the end of the file.
-    if ($pos = $parser->lastLinePos()) {
-      $batch->parser_pos = $pos;
-      $batch->setTotal(FEEDS_PARSING, filesize(realpath($batch->getFilePath())));
-      $batch->setProgress(FEEDS_PARSING, $pos);
-    }
-    else {
-      $batch->setProgress(FEEDS_PARSING, FEEDS_BATCH_COMPLETE);
-    }
-
-    // Populate batch.
-    $batch->setItems($rows);
+	return $header;
   }
 
   /**
