title: PHP - writing special characters with fwrite- looks good in notepad but wrong in browser
body: <p>I have a small issue with writing special characters (Danish, but also some symbols) text to .txt-files with PHP.
  Take this example:</p>
  
  <pre><code>&lt;?php
  
  $words = "å æ ø"; 
  
  $file = fopen("test.txt","w");
  fwrite($file, ($words));
  fclose($file);
  
  ?&gt;
  </code></pre>
  
  <p>Above code will work fine and looks correct when I open it in notepad. But for a online purpose I need to open the generated .txt-file with a browser (fx. Firefox) and in the browser the characters are not shown correctly unless I chose "Unicode" as "character encoding" from the show-menu in Firefox, default character encoding in Firefox is "western".</p>
  
  <p>If I make a normal .txt-file with notepad and write "å æ ø" and saving it the normal way it looks correctly in a browser.</p>
  
  <p>I have been searching around looking for information about encoding options for the fwrite but I don't really know where to start.</p>
  
  <p>Kind Regards</p>