But I did not find a solution to my problem.
I wrote:
NSArray *sorted = [unsorted sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
shows the sorted order A-Z with Æ and Å among A, Ø among O.
It is supposed to be A-Z-Æ-Ø-Å, since I used localized.
Overriding the user’s language for the entire application is generally not considered to be a good way to force the locale for a particular operation, as the user’s preferences should determine how data is sorted. If, for example, you have a language class or an otherwise intentionally-dual-language program), you might find it useful to the user to override the sorting order just for certain elements of the program. Although it’s a bit more work, if you need to make sure that the particular strings are always sorted in order for a particular locale, you should use the long form of the compare:
You can get the locale for Norwegian by using the call:
So, you’d end up calling:
This will not set the default language for the rest of the program, but it will explicitly use the specified locale in that particular comparison.