, żeby zakodować treść, którą następnie zapiszesz do pliku.
For those who, like me, lost a lot of minutes (hours) to understand why fwrite doesn't create a real utf-8 file, here's the explanation I've found :
I tried to do something like this :
<?php
$myString = utf8_encode("Test with accents éčŕç");
$fh=fopen('test.xml',"w"); ?>
For a mysterious reason, the resulted file shows the accent without the utf-8 conversion.
I tried the binary, mode, etc. etc. And finally I've found it :
It seems that fwrite NEEDS to have the utf8_encode function INSIDE its parameters like this, to understand it must create a non-text only file :
<?php
$myString = "Test with accents éčŕç";
$fh=fopen('test.xml',"w"); fwrite($fh,utf8_encode
($myString)); ?>
Hope this will help