? 953538.1.patch
? PATCHES.txt
Index: libraries/ParserCSV.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/libraries/ParserCSV.inc,v
retrieving revision 1.4
diff -u -p -r1.4 ParserCSV.inc
--- libraries/ParserCSV.inc	10 Jul 2010 23:45:36 -0000	1.4
+++ libraries/ParserCSV.inc	26 Oct 2010 17:54:15 -0000
@@ -184,6 +184,7 @@ class ParserCSV {
    *   Two dimensional array that contains the data in the CSV file.
    */
   public function parse(Iterator $lineIterator) {
+    $firstLine = TRUE;
     $skipLine = $this->skipFirstLine;
     $rows = array();
 
@@ -197,6 +198,14 @@ class ParserCSV {
       // Make really sure we've got lines without trailing newlines.
       $line = trim($lineIterator->current(), "\r\n");
 
+      // Remove BOM header from first line of UTF-8 files if present.
+      if ($firstLine) {
+        $firstLine = FALSE;
+        if (substr($line, 0,3) == pack('CCC',0xef,0xbb,0xbf)) {
+          $line = substr($line, 3);
+        }
+      }
+
       // Skip empty lines.
       if (empty($line)) {
         continue;
Index: plugins/FeedsFetcher.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/plugins/FeedsFetcher.inc,v
retrieving revision 1.7.4.1
diff -u -p -r1.7.4.1 FeedsFetcher.inc
--- plugins/FeedsFetcher.inc	29 Sep 2010 23:56:10 -0000	1.7.4.1
+++ plugins/FeedsFetcher.inc	26 Oct 2010 17:54:15 -0000
@@ -23,7 +23,7 @@ class FeedsFetcherResult extends FeedsRe
    *   Extending classes MAY throw an exception if a problem occurred.
    */
   public function getRaw() {
-    return $this->raw;
+    return $this->sanitize($this->raw);
   }
 
   /**
@@ -56,6 +56,23 @@ class FeedsFetcherResult extends FeedsRe
     }
     return $this->file_path;
   }
+
+  /**
+   * Sanitize the raw content string. Currently supported sanitizations:
+   *
+   * - Remove BOM header from UTF-8 files.
+   *
+   * @param string $raw
+   *   The raw content string to be sanitized.
+   * @return
+   *   The sanitized content as a string.
+   */
+  public function sanitize($raw) {
+    if (substr($raw, 0,3) == pack('CCC',0xef,0xbb,0xbf)) {
+      $raw = substr($raw, 3);
+    }
+    return $raw;
+  }
 }
 
 /**
Index: plugins/FeedsFileFetcher.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/plugins/FeedsFileFetcher.inc,v
retrieving revision 1.22.2.5
diff -u -p -r1.22.2.5 FeedsFileFetcher.inc
--- plugins/FeedsFileFetcher.inc	5 Oct 2010 23:01:39 -0000	1.22.2.5
+++ plugins/FeedsFileFetcher.inc	26 Oct 2010 17:54:15 -0000
@@ -23,7 +23,7 @@ class FeedsFileFetcherResult extends Fee
    * Overrides parent::getRaw();
    */
   public function getRaw() {
-    return file_get_contents($this->file_path);
+    return $this->sanitize(file_get_contents($this->file_path));
   }
 
   /**
Index: plugins/FeedsHTTPFetcher.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/plugins/FeedsHTTPFetcher.inc,v
retrieving revision 1.29.2.1
diff -u -p -r1.29.2.1 FeedsHTTPFetcher.inc
--- plugins/FeedsHTTPFetcher.inc	29 Sep 2010 23:56:10 -0000	1.29.2.1
+++ plugins/FeedsHTTPFetcher.inc	26 Oct 2010 17:54:15 -0000
@@ -32,7 +32,7 @@ class FeedsHTTPFetcherResult extends Fee
     if (!in_array($result->code, array(200, 201, 202, 203, 204, 205, 206))) {
       throw new Exception(t('Download of @url failed with code !code.', array('@url' => $this->url, '!code' => $result->code)));
     }
-    return $result->data;
+    return $this->sanitize($result->data);
   }
 }
 
