Fai salva con nome. tra le varie caselle della finestra che si apre dovrebbe esserci quella per specificare la codifica (non so però se è offerta da tutti gli editor).
Un altro problema potrebbe essere l'encoding del txt. ora mi informo.
EDIT: ho trovato questo commento alla fwrite su
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");
fwrite($fh,$myString);
fclose($fh);
?>
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));
fclose($fh);
?>
Hope this will help