Let's say I have the following basic HTML page
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
\u00f2
</body>
</html>
When the page renders, what I see is \u00f2 whereas I was expecting ò. And there comes the big "but". With the following Javascript code, what I see is the ò character (2 seconds later).
$(function(){
window.setTimeout(function(){
$("body").html("\u00f2")},2000);
});
});
My question is, why is this happening? I am aware of rather than rendering the Unicode codepoints, I could convert them to HTML entities and render the correct character directly. The question is more for learning purposes.
Here is the jsbin