1 2 3 4 5 6
$str = file_get_contents('yourfile.utf8.csv'); $bom = pack("CCC", 0xef, 0xbb, 0xbf); if (0 === strncmp($str, $bom, 3)) { echo "BOM detected - file is UTF-8\n"; $str = substr($str, 3); }
You can clone a snippet to your computer for local editing. Learn more.