title: How to write a file in UTF-8 format
body: <p>I have read a XML file with the <code>simplexml_load_file()</code> function. I suppose this function is well written and supports XML encodings correctly. My XML file is in UTF-8 format, i.e. it contains normal ANSI characters along with national characters with multibyte encoding.</p>
  
  <p>So, now I want to write the XML file back with <code>fopen()</code> and <code>fwrite()</code>, also in UTF-8 format.</p>
  
  <p>Should I perform some conversions to do that correctly? </p>
  
  <p>Suppose variable <code>$a</code> contains some UTF-8 encodings. Will it be written correctly?</p>