NOBUG: BOM rebombed from 19_STABLE
authorEloy Lafuente <stronk7@moodle.org>
Thu, 8 Apr 2010 18:16:26 +0000 (18:16 +0000)
committerEloy Lafuente <stronk7@moodle.org>
Thu, 8 Apr 2010 18:16:26 +0000 (18:16 +0000)
mod/data/import.php

index 6130149..34ae1b0 100755 (executable)
@@ -108,9 +108,12 @@ if ($um->preprocess_files() && confirm_sesskey()) {
         @apache_child_terminate();
     }
 
-    //Fix mac/dos newlines
+    // Fix mac/dos newlines
+    // TODO: Switch to cvslib when possible
+    $textlib = textlib_get_instance();
     $text = my_file_get_contents($filename);
     $text = preg_replace('!\r\n?!',"\n",$text);
+    $text = $textlib->trim_utf8_bom($text); // remove Unicode BOM from first line
     $fp = fopen($filename, "w");
     fwrite($fp, $text);
     fclose($fp);