title: Write a file with encoding UTF-8 in php
body: <p><strong>P.S.: It is not a duplicated question, because I'm not looking to write contents in a file because it is already done, I'm looking to change a type of a file to be UTF-8, there is a difference in it.</strong> </p>
  
  <p>How to generate the UTF-8 file and not ANSI. (Is not the contents).</p>
  
  <p>For example, the most IDE have an option encoding, where you are able to modify the type of your file, but I'm generating a bulk from my database, and it generates a lot of individual text files, but the whole files is ANSI default.. I'm just looking for a function in php that make it possible to change the encoding before it generates the bulk.</p>
  
  <p>If the source code help I can post it here. just let me know.</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>EDITED</strong></p>
  
  <p><em>Follow a print of what I'm asking here.</em></p>
  
  <p><img src="https://i.stack.imgur.com/dccvY.png" alt="enter image description here"></p>
  
  <p>When I generate the file "testecli01.csv" it always get encoding ANSI, whatever I do in my script it is always ANSI, and I need in UTF-8, just this. Is simple but I have no idea how to do. </p>