title: What is the default JavaScript character encoding?
body: <p>While writing an encryption method in JavaScript, I came to wondering what character encoding my strings were using, and why.</p>
  <p>What determines character encoding in JavaScript? Is it a standard? By the browser? Determined by the header of the HTTP request? In the <code>&lt;META&gt;</code> tag of HTML that encompasses it? The server that feeds the page?</p>
  <p>By my empirical testing (changing different settings, then using <code>charCodeAt</code> on a sufficiently strange character and seeing which encoding the value matches up with) it appears to always be UTF-8 or UTF-16, but I'm not sure <em>why</em>.</p>
  <p><sub>After some frantic googling, I couldn't seem to find a conclusive answer to this simple question.</sub></p>