macOS apps unexpectedly sorting "Aa" after "Z" (Danish Collation)

Here’s a problem I posed on the “Ask Different” Stack Exchange site recently, but I didn’t receive any answers there. Maybe someone here has some ideas of things I could investigate to find the root cause of my problem.

This is on Ventura 13.5.2 (and still present on 13.6), an account that I’ve migrated through many computers and versions of Mac OS X, so there could be some lingering cruft causing this problem.

To the best of my knowledge, I’ve only ever used en_US language/locale on my computer.

I noticed today that Quicken was sorting the names “Aaron” and “AARP” after the letter Z in my list of payees. BBEdit was doing the same. But a folders in the Finder were alphabetized correctly, and passing a list to sort in a Terminal window worked as well.

From the Wikipedia page on Alphabetical Order, I learned that:

“In the Danish and Norwegian alphabets, the same extra vowels as in Swedish (see below) are also present but in a different order and with different glyphs (…, X, Y, Z, Æ, Ø, Å). Also, “Aa” collates as an equivalent to “Å”.”

My Terminal shows the following:

$ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=

My “Language & Region” System Settings lists “English (US) – Primary” as my only language, and “United States” as my Region.

What other methods can I use to get or set macOS’s language/region?

Update:

I checked another account that I recently created on this computer, and it lists “English – Primary” as the language (note the missing “(US)”). When I sort in BBEdit from that account, I get the correct order.

But I’ve been unable to get “English – Primary” on my current account. I switched to French and removed English entirely, rebooted, and when I tried to add “English” instead of “English (US)”, it still added the “English (US)”.

It sounds like this only happens in 3rd party apps. Have you asked in their support forums whether anyone else sees such a problem?

In system settings > general > language & region toward the bottom is a place to set List Sort Order. But I would expect that to affect all apps. What do you have there?

A long shot, but maybe it can point to some things you can investigate: Since the problem only seems to affect some apps, perhaps there are per-app settings that are causing it. (Settings are sometimes termed “preferences” or “defaults”.)

If an app uses standard macOS mechanisms for settings, there is a hierarchy of settings that are typically used, with settings for a user stored in ~/Library/Preferences, and settings for all users stored in /Library/Preferences.

~/Library/Preferences also contains .GlobalPreferences.plist and .GlobalPreferences_m.plist, each of which contain locale info.

Unfortunately, BBEdit doesn’t seem to store its settings that way. (Although I did find a file, BBEdit Preferences Backup.plist, in ~/Library/Application Support/BBEdit/Setup.)

I emailed BBEdit Support, and got the following response from Rich Siegel:

So that leads me to believe it’s a macOS-level setting that I’m dealing with.

I don’t have a “List Sort Order” in that preference pane in Ventura. Maybe it’s new in Sonoma, or was present in an older version of macOS?

I used plutil to dump all of those plist files as text so I could grep -i locale on them, but didn’t turn up any locales other than “en” or “en_US”.

I know one of the Quicken developers, and he said they just rely on the underlying OS to do their sorting. Based on Rich Siegel’s response for BBEdit, I assume this is related to using an older collator API that is somehow pulling an old locale setting of mine.

Solved!

The ideas in your responses led me down a path that ended with me finding that AppleCollationOrder in the .GlobalPreferences.plist file was set to nb, the locale for Norwegian Bokmål.

I also learned that the command-line defaults utility reads/writes that file. So after executing the command defaults delete -g AppleCollationOrder and relaunching BBEdit, my sorts are working as expected!

5 Likes

I am also on Ventura. Perhaps the List Sort Order item only appears if you have multiple languages on your preferred language list. It is at the bottom just after Number Format and before Live Text.