note 55054 modified in function.fwrite by aidan
| From: | aidan@php.net | Date: | Sun, 24 Jul 2005 04:16:26 +0000 |
| Subject: | note 55054 modified in function.fwrite by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-92357@lists.php.net to get a copy of this message | ||
[Editor's Note: No, you only need to use this if you want a BOM (Byte order mark) added to the
document - most people do not.]
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);
?>
--was--
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);
?>
http://php.net/manual/en/function.fwrite.php