function writeUTF8File($filename, $content) { $f = fopen($filename,"w"); // UTF-8 - add byte order mark fwrite($f, pack("CCC",0xef,0xbb,0xbf)); …