Generate . txt file with PHP with "til" (~) etc

Asked

Viewed 590 times

-1

I am unable to generate a file . txt where the tilde and accents are printed correctly. I am using the fwrite.

excerpt from the code:

$arquivo  = fopen('aaa.txt', 'w+');
$escrever = fwrite($arquivo, $txt);

fclose($arquivo);
  • already tried utf8_encode($txt)?

  • o aqurivo php, must be in some format that is not UTF-8, open the file in an editor like Notepad++ and change the format to UTF-8 without BOM, and see if there are any files in include if you have them also must be in the same format

1 answer

0


I solved! The problem was to switch to mysqli_set_charset($connected, 'iso-8859-1'); in connection with the database! Basic and simple thing that took my time.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.