Open
Description
I wrote a node.js program to generate HTML code, the core:
console.log(['\uFEFF<!DOCTYPE html><html><body><p></p><script>',
String(charCodes),
'console.log(charCodes(' + jsStringify(animals) + '));',
'console.log(' + charCodes(jsStringify(animals)) + ');',
'</script></body></html>'].join('\n'));
I gisted the full source, also the generated HTML and what Firefox prints in its console when loading the HTML:
{ "dog": "[d83d][dc15]", "cow": "[d83d][dc04]", "halfbreed": "[fffd][fffd]" }
{ "dog": "[d83d][dc15]", "cow": "[d83d][dc04]", "halfbreed": "[dc15][d83d]" }
As you can see, in the first expression, the halfbreed characters both became U+FFFD. Probably some Unicode interpolation is messing with JavaScript's UCS-2 characters. Is this a bug? If a feature instead, it should be documented more prominently.
Metadata
Metadata
Assignees
Labels
No labels