I have encountered a strange issue with IE11. Consider the following (part of the riot.js framework):
var s = "{JSON.stringify(\\{ amount: Math.floor(reward.amount) \\})}";
var s1 = s.replace(/\\{/g, '\uFFF0');
When running this code on localhost, it runs fine. But when running from our staging environment, the \{
fragment is replaced not by \uFFF0
(codepoint 65520) but by \uFFFD
(codepoint 65533). That means it fails later when trying to replace the special character back to {
.
The replace
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 charset=utf-8
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.
I have no idea why it does that, or why it's not systematic.