note 105124 deleted from function.fwrite by danbrown
| From: | danbrown@php.net | Date: | Thu, 28 Jul 2011 23:11:28 +0000 |
| Subject: | note 105124 deleted from function.fwrite by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-181983@lists.php.net to get a copy of this message | ||
Note Submitter: shinkuchan69 at gmail dot com
Reason: non-english
----
gracias Eugene Murai, y zaccraven por su aporte, realmente me fue de mucha ayuda el pasar el texto a
unicode.
primero tuve que cambiar el texto a utf8 con la función utfo8_encode ya que me suprimÃa las
letras con acentos, pero funcionó super.
$fd_o = fopen ($origen, "r");
// le damos la propiedad al archivo creado "W"
$fp_d = fopen($destino, "w+");
while (!feof($fd_o)) {
$buffer = fgets($fd_o, 4096);
$buffer = utf8_encode($buffer);
$buffer = chr(255).chr(254).mb_convert_encoding( $buffer, 'UTF-16LE',
'UTF-8');
fputs($fp_d, $buffer);
}
fclose ($fd_o);
fclose ($fd_d);