Why is the TXT file having problems using file_put_contents?

-1

I'm creating files with the "file_put_contents" function of PHP, on my machine it opens normal on notepad ++, but when I send it to someone and it will open in ultra edit it asks "Do you want to convert 'file.txt' to DOS format? "

The function I'm using in a simple way

$dados  = "Olá mundo!";
file_put_contents("arquivo.txt", $dados, FILE_APPEND);

How to solve it, I already looked at the web but did not see anything that I might be doing wrong.

Error screen:

    
asked by anonymous 24.06.2016 / 20:26

1 answer

0

See if this solves your problem:

<?php 

$dados  = "Olá mundo!";
$copy_utf16 = iconv("UTF-8", "UTF-16LE", $dados);
file_put_contents("arquivo.txt", $copy_utf16, FILE_APPEND);

?>

< See this SOen question

    
24.06.2016 / 20:51