Javascript charCodeAt not reading correct codes
<p>I was trying to host a code of mine from Khan Academy on my own website.
The processing code works alright on Khan Academy. But while hosting it I am facing some issues. </p>

<p>The problem is - Khan Academy's processing is able to read unicode value of certain characters correctly, but when I do the same offline from the browser it gets incorrectly shown.</p>

<p>I think it has to do with the charCodeAt function not working correctly. </p>

<p>Here's my code :-</p>

<pre><code>var test = "Ĭ";
println(test);
println(test.charCodeAt(0));
</code></pre>

<p>On Khan Academy the unicode is correctly printed as 300. Wherease my browser prints it as 196. Whats more the string is interpreted as 2 characters instead of 1 from the browser. It's size is shown as 2.</p>

<p>How to make the charCodeAt to work correctly. </p>

<p>Please note that I am making use of Processing JS and here is the code I am making use of to host a Processing Canvas :-</p>

<pre><code>var sketchProc=function(processingInstance){ with (processingInstance)   {
size(400, 400); 
frameRate(60);



var test = "Ĭ";
var n = test.codePointAt(0);

println(n);

println(String.fromCharCode(300));
println(test.length);

}};
</code></pre>

<p>Thanks.</p>