JavaScript Collation Fail
In JavaScript, the localeCompare method on Strings seems like a great way to properly sort strings, but its not:

Hint: The last line should all look the same. At least I expect Firefox and Opera to agree. You can’t expect much from IE6.
For kicks try out other browsers and post the final sorted list in the comments (hopefully my blog supports unicode).
Tags: i18n, javascript, l10n, localecompare, unicode, utf8, webdev
July 14th, 2008 at 2:38 pm
Here it is in Safari 3 / Webkit:
July 14th, 2008 at 2:39 pm
Doh.
Html got Stripped. Here’s the link to the image:
http://idisk.mac.com/afruit-Public/safari-js-test.png
July 14th, 2008 at 3:01 pm
Just testing out copying and pasting from the test page:
a,A,ä,æ,q,R,z,Z
Hm… Safari and Firefox agree. Wonder what IE7 & 8 have to say… I guess IE6 is pretty close to Safari and FF. Seems Opera is the only one completely crazy.
July 14th, 2008 at 4:02 pm
I’ve been noticing Firefox 3 being closer to Safari, then Firefox 3 is to Firefox 2 –specifically with CSS rendering and stuff. (Which doesn’t have much to do with JS, but it’s just a general thing I’ve observed)
Webkit advocates do rave about the new JavaScript engine called “Squirrelfish”.
http://webkit.org/blog/189/announcing-squirrelfish/
Which brings a reminder about the Dr. Moreau conversations we’ve had.
August 12th, 2008 at 5:26 pm
IE7: string_list.sort(localesort): a,A,ä,æ,q,R,z,Z