title: How do I save a file as UTF-8 from Perl?
body: <p>I'm trying to create/save HTML files in Perl in UTF-8, but nothing I have done so far works. A <a href="https://stackoverflow.com/questions/627661/how-can-i-output-utf-8-from-perl">previous answer here on SO</a> said to use binmode, so I tried that. Here is my code:</p>
  
  <pre><code>open (OUT, "&gt;$sectionfilename");
  binmode(OUT, ":utf8");
  print OUT $section;
  close OUT;
  </code></pre>
  
  <p>When I open these files in a text editor like Notepad they are still in ANSI encoding. What am I doing wrong?</p>