title: String.replace strange behaviour in IE11
body: <p>I have encountered a strange issue with IE11. Consider the following (part of the riot.js framework):</p>
  
  <pre><code>var s = "{JSON.stringify(\\{ amount: Math.floor(reward.amount) \\})}";
  var s1 = s.replace(/\\{/g, '\uFFF0');
  </code></pre>
  
  <p>When running this code on localhost, it runs fine. But when running from our staging environment, the <code>\{</code> fragment is replaced not by <code>\uFFF0</code> (codepoint 65520) but by <code>\uFFFD</code> (codepoint 65533). That means it fails later when trying to replace the special character back to <code>{</code>.</p>
  
  <p>The <code>replace</code> method is the browser's native one. The file that contain both the HTML (string is a DOM attribute) and the javascript is returned by the server with <code>charset=utf-8</code> header and encoded as such. In staging environment, it is bundled with other files (not compression or mangling though) and still encoded in utf-8.<br>
  I have no idea why it does that, or why it's not systematic.</p>