Wednesday, October 03, 2012

php save file as utf-8


$file_contents = "Mañana";
$path_to_file = "myfile.txt";

$f=fopen($path_to_file, "wb");
$file_contents="\xEF\xBB\xBF".$file_contents; // utf-8 bom
fputs($f, $file_contents);
fclose($f);

No comments:

Post a Comment