title: Encoding a file to base 64 Nodejs
body: <p>I used the code below to encode a file to base64.</p>
  <pre class="lang-js prettyprint-override"><code>var bitmap = fs.readFileSync(file);
  return new Buffer(bitmap).toString('base64');
  </code></pre>
  <p>I figured that in the file we have issues with <code>“”</code> and <code>‘’</code> characters, but it’s fine with <code>&quot;</code></p>
  <p>When we have <code>It’s</code>, node encodes the characters, but when I decode, I see it as
  <code>Itâ€™s</code></p>
  <p>Here's the javascript I'm using to decode:</p>
  <pre class="lang-js prettyprint-override"><code>fs.writeFile(reportPath, body.buffer, {encoding: 'base64'}
  </code></pre>
  <p>So, once the file is encoded and decoded, it becomes unusable with these funky characters - <code>Itâ€™s</code></p>
  <p>Can anyone shed some light on this?</p>