title: Javascript charset encoding
body: <p>A client asked for a web crawler which analysis his website and generates a CSV file with some info from the website, but I'm having encoding issues.</p>
  
  <p>I inspected the page and I can see that the <code>Content-Type</code> header is set to <code>"text/html; charset=utf-8"</code> and the meta tag for <code>Content-Type</code> has the same value.</p>
  
  <p>I use simple string concatenation to generate the results, as in <code>CONTENT += line + '\r\n';</code> and, when ready, I prompt a file download:</p>
  
  <pre><code>var data = new Blob([CONTENT], { type: 'text/plain; charset=utf-8' });
  saveAs(data, 'crawler.csv');
  </code></pre>
  
  <p>I would expect the encoding to be correct, as all content is using UTF-8 encoding, but it isn't, and I still get some improper encoding, somehow, as in <code>RADIOFREQUÃNCIA</code>, where it should read <code>RADIOFREQUÊNCIA</code>. In most cases accents and diacritics are replaced by <code>Ã</code>.</p>
  
  <p>I tried using several encoding/decoding methods but to no effect. Anybody has some recommendations?</p>