J'ai un problème concernant un fichier .txt (codage UTF-8 à la base) que j'édite via un simple formulaire, seulement lorsque je valide mon texte il retourne au format ANSI.
Si j'ai besoin qu'il reste en UTF-8 c'est dans l'optique qu'une animation swf puisse lire les accents de ce texte dans un champs dynamique standard appelé à l'aide de this.texteur.loadVariables("texte.txt"); sous flash.
Donc y a t-il un code pour permettre à mon fichier de rester un UTF-8?
Voici mon code très simple car je débute en php pour éditer ce texte: (act.php)
<?php
$ressource_fichier = fopen('texte.txt', 'w');
if($ressource_fichier AND is_writable('texte.txt'))
{
fputs($ressource_fichier, htmlentities($_POST['description']));;
fclose($ressource_fichier);
}
?>
Et si il y a besoin mon formulaire: (rec.php)
[
<?php
$fichier = file_get_contents('texte.txt');
echo $fichier;
?>
</div>
<form action="act.php" method="post">
<p align="center"><textarea name="description" rows="1" cols="200">textfield=</textarea></p>
<p align="center"><input type="submit" value="Envoyer" /></p>
</form>
Si quelqu'un pouvait m'aider ou m'indiquer la marche à suivre, j'en serais plus que ravi!!!Merci par avance