JavaScript Collation Fail


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

localeCompare Javasript method in 4 browsers

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).

Updated 2012-05-16: Hilariously a coworker stumbled across this page, so I updated the MDN link as Mozilla had broken it.