Bonjour,
je souhaiterait savoir comment écrire dans un fichier en UTF8 ? Acutellement j'utilise les fonction fopen et fwrite mais je sait pas trop en quoi ca encode.
Bonjour,
je souhaiterait savoir comment écrire dans un fichier en UTF8 ? Acutellement j'utilise les fonction fopen et fwrite mais je sait pas trop en quoi ca encode.
Je viens de trouver ça dans la doc officielle, ça pourra peut être t'aider :
if you have to write a file in UTF-8 format, you have to add an header to the file like this :
<?php
$f=fopen("test.txt", "wb");
$text=utf8_encode("�a�!");
// adding header
$text="\xEF\xBB\xBF".$text;
fputs($f, $text);
fclose($f);
?>
Partager