title: Yii2 always set header to "UTF-8 with BOM" for saving files
body: <p>In Yii2 I have controller that save some texts from database to .csv file. It contains russian (cyrillic) language. The problem is when I open file in Excel, it has bad charset: Ð³Ñ€ÑƒÐ·Ð¾Ð²Ð</p>
  
  <p>For Mac OS and Windows users Excel charset result is the same. Opening in notepad is okey. BUT Notepad says it has coding "UTF-8 with BOM". If I save to "UTF-8" from notepad, Excel reads good .csv file.</p>
  
  <p>Code:</p>
  
  <pre><code>Yii::$app-&gt;response-&gt;format = \yii\web\Response::FORMAT_RAW;
  Yii::$app-&gt;response-&gt;charset = 'utf-8';
  Yii::$app-&gt;response-&gt;headers-&gt;set('Content-Type', 'text/csv; charset=utf-8');
  Yii::$app-&gt;response-&gt;headers-&gt;add('Content-Disposition', 'attachment; filename="myfile.csv"');
  // header('Content-Type: text/plain; charset=UTF-8',true);
  </code></pre>
  
  <p><strong>Any ideas what might be wrong?</strong> I tried a lot of charsets (windows-1251, cp1251), text/plain -- no results. <strong>Moreover</strong>, strange chars always the same even if I set charset to chinese or any other.</p>
  
  <p><strong>It is like headers charset are not changed and always "UTF-8 with BOM".</strong></p>
  
  <p><code>Yii::$app-&gt;charset</code> is 'UTF-8', changing <code>text/csv</code> to <code>text/plain</code> or even <code>text/json</code>, or saving as .txt and open it in Excel - the same results.</p>