Here is my code:
<?php
header("Content-Type: text/html; charset=UTF-8");
header("Content-Type: application/x-javascript; charset=UTF-8");
$fName = "demo.txt";
$str = "óé";
fid = fopen($fName, 'wb') or die("can't open file"); // Open file
fwrite($fid, $str); // Write to file
fclose($fid); // Close file
?>
To the screen, the output is:
óéü
When I open the file I get:
óéü
I am trying to save large amounts of data using fwrite, but the characters are not encoding correctly at the point of file save.
Thanks in advance.