not only that: it's different depending on locale and sometimes context (in Germany there's a distinction of whether you sort for a phone book listing or not).
Doing it right requires basically shipping a huge database with locale specific information which is seen as "bloat" by many projects and thus made optional or not available at all.
>and it's pretty amazing that unicode gives us a standard collation algorithm including localizations, that works remarkably well.
it's not good enough in many cases. Thankfully there's ICU, but many environments frown upon that because it's seen as bloated. If sorting works "fine" for US-ASCII, why link to a 60MB library?
ICU stands for "International Components for Unicode." ICU collation is an implementation of the Unicode Collation Algorithm (which is really a suite of algorithms, or an algorithm with various parameterized branches), using the Unicode Common Locale Data Repository for localization -- that's also unicode, the CLDR is a unicode thing too, part of unicode. It's all unicode.
There are other implementations than ICU -- although maybe none as complete, because it is a lot/expensive, indeed. But ICU is an implementation of unicode algorithms. But for instance, unicode collation is also implemented -- in a way that will be the same as ICU modulo bugs or details the standard leaves up to implementations to vary -- in pure ruby by https://github.com/twitter/twitter-cldr-rb#sorting-collation
Which is how you implement high-performance unicode collation sorting in say a db.
Unicode is a very well-designed thing!
NSString would occasionally come up in performance analysis as being strangely slow compared with other languages, but this was because various operations like comparisons followed unicode.
But... is complicated enough to implement that many environments apparently haven't felt there was enough demand to do so?