$f=fopen("test.txt", "wb"); $text=utf8_encode("顨!"); // adding header $text="\xEF\xBB\xBF".$text; fputs($f, $text); fclose($f); ?>