title: Angular file download breaks UTF-8 BOM
body: <p>I have made script with PHP which is used for generating CSV file with UTF-8 BOM encoding and it works fine whenever I download file through url, like:
  www.example.com/generateCSV</p>
  
  <p>PHP code:</p>
  
  <pre><code>   $file = tempnam(sys_get_temp_dir(), 'mycsv');
     $df = fopen($file, 'w');
     fprintf($df, chr(0xEF).chr(0xBB).chr(0xBF));
     fputcsv($df, ['sd123123123čęėąėąčę', 'ąčęąčęąęąčę'], ';');
     fclose($df);
  
     header('Content-Type: text/csv; charset=utf-8');
     header('Content-Disposition: attachment; filename=csv.csv');
     header("Cache-Control: no-store, no-cache");
     readfile($file);
  </code></pre>
  
  <p>However, when I download file with angular, I get problem with encoding. Characters are not more recognised as UTF-8 valid and they break.
  For csv file download I use this angular code:</p>
  
  <pre><code>t.prototype.downloadCsv = function () {
        var t = this, e = {
          date_from: this.helpers.formatDate(this.filter.date_from),
          date_to: this.helpers.formatDate(this.filter.date_to),
          download: "fees"
        };
        this.http.get("team-accounts/" + this.route.snapshot.params.id, e).subscribe(function (n) {
          var i = {type: "text/csv;charset=utf-8;"},
            r = t.account.team.name + "_summary_" + e.date_from + "_" + e.date_to + ".csv";
          t.helpers.downloadFile(n._body, i, r)
        })
      }
  </code></pre>
  
  <p>Does any one sees what could be the problem ?
  Why loading page through direct link works fine, but then I load it through angular it stops displaying characters correctly ?</p>
  
  <p>downloadFile function:</p>
  
  <pre><code>t.prototype.downloadFile = function (t, e, n, i) {
        var r = new Blob([t], e);
        if (navigator.msSaveBlob) navigator.msSaveBlob(r, n); else {
          var a = document.createElement("a");
          if (void 0 !== a.download) {
            var o = i || document.body, s = URL.createObjectURL(r);
            a.setAttribute("href", s), a.setAttribute("download", n), a.style.visibility = "hidden", o.appendChild(a), a.click(), o.removeChild(a)
          }
        }
      }
  </code></pre>