hankknight
asked on
What character encoding does fwrite use?
What character encoding does fwrite use by default and how can this be controlled?
<?php
$data = "Hello. Buenos días. Ça Va. Yá'át'ééh.";
$fp = fopen($file, 'w');
fwrite($fp, $data);
fclose($fp);
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
fwrite($fh,utf8_encode($my
The problem is that the string is ALREADY in UTF-8 encoding.
And to double encode this could cause some problems!
https://www.experts-exchange.com/questions/24146810/using-utf8-encode-on-text-that-is-already-encoded.html
So I can't leave it as it is because of the UTF-8 fwrite bug you noted. And I can't convert it because it would get scrambled! Either way the text gets damaged!