shedokan Posted December 8, 2007 Share Posted December 8, 2007 is there a way to remove BOM after creation of a file? here's the script that I create my file with <?php function writeUTF8File($filename,$content) { $f=fopen($filename,"w"); # Now UTF-8 - Add byte order mark fwrite($f, pack("CCC",0xef,0xbb,0xbf)); fwrite($f,$content); fclose($f); } ?> I found this function but I don't know how to use it: <?php function removeBOM($str=""){ if(substr($str, 0,3) == pack("CCC",0xef,0xbb,0xbf)) { $str=substr($str, 3); } return $str; } ?> Link to comment https://forums.phpfreaks.com/topic/80756-how-to-remove-bom-with-php/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.