How does JavaScript decide sort order with characters from different character sets?
<p>I was working on some code where I need to perform an alphabetic ascending sort (standard <code>.sort()</code>) behavior and I wondered how sorting works with special characters and characters from different character sets. For example:</p>

<pre><code>var aChars = [];

aChars.push("¢");
aChars.push("™");
aChars.push("È");
aChars.push("~");
aChars.push("p");
aChars.push("_");
aChars.push("P");
aChars.push("治");
aChars.push("す");

aChars.sort();

for (var i = 0;i&lt;aChars.length;i++) {
    console.log(aChars[i]);
    //alert(aChars[i]);   
}​
</code></pre>

<p>I always get a consistent order when I execute this code. How does JavaScript decide the order? I thought it might be by HTML entity number, but I can't find an HTML entity number for those Japanese characters.</p>
