[Bug]: Wrong sort order for Swedish national characters Å, Ä and Ö #2869

Open
opened 2026-02-20 03:02:10 -05:00 by deekerman · 4 comments
Owner

Originally created by @Cotignac on GitHub (Mar 27, 2025).

What happened?

The alphabetic sort order is wrong for the Swedish national characters.

What did you expect to happen?

The letters from A to Z is correct, but the national characters Å, Ä and Ö is wrong.
I expected them to come in the order like I wrote above Å, Ä, Ö but currently the order is Ä, Å, Ö.

Steps to reproduce the issue

  1. Go to the page with all authors or books and sort them in alphabetical order. You'll see that the order is wrong.

Audiobookshelf version

2.20.0

How are you running audiobookshelf?

Docker

What OS is your Audiobookshelf server hosted from?

Linux

If the issue is being seen in the UI, what browsers are you seeing the problem on?

Edge

Logs


Additional Notes

No response

Originally created by @Cotignac on GitHub (Mar 27, 2025). ### What happened? The alphabetic sort order is wrong for the Swedish national characters. ### What did you expect to happen? The letters from A to Z is correct, but the national characters Å, Ä and Ö is wrong. I expected them to come in the order like I wrote above Å, Ä, Ö but currently the order is Ä, Å, Ö. ### Steps to reproduce the issue 1. Go to the page with all authors or books and sort them in alphabetical order. You'll see that the order is wrong. ### Audiobookshelf version 2.20.0 ### How are you running audiobookshelf? Docker ### What OS is your Audiobookshelf server hosted from? Linux ### If the issue is being seen in the UI, what browsers are you seeing the problem on? Edge ### Logs ```shell ``` ### Additional Notes _No response_
Author
Owner

@advplyr commented on GitHub (Mar 27, 2025):

We are doing case-insensitive sorting so I'm not sure if the lowercase equivalent changes things.

@mikiher and @devnoname120 did a lot of work on unicode, any thoughts?

@advplyr commented on GitHub (Mar 27, 2025): We are doing case-insensitive sorting so I'm not sure if the lowercase equivalent changes things. @mikiher and @devnoname120 did a lot of work on unicode, any thoughts?
Author
Owner

@Cotignac commented on GitHub (Mar 27, 2025):

I tested to change the spelling of the last name of two authors from a capital Å to å and a capital Ä to ä. Unfortunately that didn't change anything. The order they came in was still ä before å.

@Cotignac commented on GitHub (Mar 27, 2025): I tested to change the spelling of the last name of two authors from a capital Å to å and a capital Ä to ä. Unfortunately that didn't change anything. The order they came in was still ä before å.
Author
Owner

@Cotignac commented on GitHub (Mar 27, 2025):

I don't know if it's of any interest, but when I changed from Å to å and from Ä to ä the authors ended up after an author with a last name starting with Ö - the last letter in the Swedish alphabet.

@Cotignac commented on GitHub (Mar 27, 2025): I don't know if it's of any interest, but when I changed from Å to å and from Ä to ä the authors ended up after an author with a last name starting with Ö - the last letter in the Swedish alphabet.
Author
Owner

@mikiher commented on GitHub (Mar 27, 2025):

We currently sort using COLLATE NOCASE for title/author sort on the library page, which does not work for non-ascii characters reliably.

Nunicode supports a non-locale-speciic unicode nocase collation, but even if we switch to that, it might still not correctly sort locale-specific variants like the Swedish example above. I think it may be possible to load locale-specific collations (I need to check), but then we'd need a setting that tells us which locale to use (we can piggyback on display language, but I'm not sure that would be good choice).

Bottom line - I think supporting this properly is complex, and requires more investigation.

@mikiher commented on GitHub (Mar 27, 2025): We currently sort using `COLLATE NOCASE` for title/author sort on the library page, which does not work for non-ascii characters reliably. Nunicode supports a non-locale-speciic unicode nocase collation, but even if we switch to that, it might still not correctly sort locale-specific variants like the Swedish example above. I think it may be possible to load locale-specific collations (I need to check), but then we'd need a setting that tells us which locale to use (we can piggyback on display language, but I'm not sure that would be good choice). Bottom line - I think supporting this properly is complex, and requires more investigation.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/audiobookshelf#2869
No description provided.