@apache_child_terminate();
}
- //Fix mac/dos newlines
$text = my_file_get_contents($filename);
+ //trim utf-8 bom
+ $textlib = new textlib();
+ $text = $textlib->trim_utf8_bom($text);
+ //Fix mac/dos newlines
$text = preg_replace('!\r\n?!',"\n",$text);
$fp = fopen($filename, "w");
fwrite($fp,$text);
return $result;
}
+ /**
+ * Removes the BOM from unicode string - see http://unicode.org/faq/utf_bom.html
+ */
+ function trim_utf8_bom($str) {
+ $bom = "\xef\xbb\xbf";
+ if (strpos($str, $bom) === 0) {
+ return substr($str, strlen($bom));
+ }
+ return $str;
+ }
}
?>