I have a large file that contains countries of the world / regions, which I divide into smaller files based on individual countries / regions. The source file contains entries like:
EE.04 Järvamaa
EE.05 Jõgevamaa
EE.07 Läänemaa
However, when I extract this and write it to a new file, the text becomes:
EE.04 Järvamaa
EE.05 Jõgevamaa
EE.07 Läänemaa
To save my files, I use the following code:
mb_detect_encoding($text, "UTF-8") == "UTF-8" ? : $text = utf8_encode($text);
$fp = fopen(MY_LOCATION,'wb');
fwrite($fp,$text);
fclose($fp);
I tried to save files with and without utf8_encode (), and none of them work. How can I save the original encoding (which is UTF8)?
Thank!
source
share