Locale independent lexicographical sort

In my language(Danish), we have some diphthongs (ae, oe, aa) that are placed last in the alphabet. This affects the sorting in a bad way, when you are trying to sort technical terms. Are there some way to make LibreOffice sort purely lexicographical from the ASCII or Unicode order?

Edit - example sort:

This list:

Randers Aalborg København Ribe Arslev

Sorted with danish:

Arslev København Malling Randers Ribe

Notice the problematic Aa (lborg).


The list is correctly sorted by danish rules. But I want a language independent sorting.

You have as well an “ø” in your example as an Aa supposedly replacing an “Å”. What if “København” was written as “Koebenhavn”. Should the digraph “oe” then be treated differently as compared with the “ø”? I do not know anything about Danish, but I think “Aalborg” is rightfully placed at the end independently of whether it is written as above or as “Ålborg”. What did I misunderstand?

@Lupp: The list is correctly sorted by danish rules. As written, I do not want danish rules. I do not want any locale dependent sorting, but purely sorting from the ASCII or Unicode order.

Shall there nonetheless be allowed Danish special characters or any non-alphabetic characters or special characters from different languages? How should digits, spaces … be treated? Shall upper/lower case be distinguished? As there is no sort option like “lexicographic by Unicode”, these questions are relevant. Anyway you will have to accept some preparing expense for a workaround. Please understand that I want to know the actual conditions before I spend more time on this.

@Lupp: I was hoping, that there were some option, that I overlooked that would alow me to do this. I do not have answers to all of your questions, as I need the option for several different tasks, but always with different technical words (file names, hash, generated passwords, -mixed letters, numbers and special chars). I can say for sure, that I do not whish to sort white spaces or non-printable chars. If the option does not excist, please do not use time on it.

@Lupp: Maybe you have some insight on how English sorting works compared to what I want? It could be the the same, but right now I have no way to know or find out.

@hpekristiansen: Unicode you refer to is simply “too big” for a generally applicable workaround. You should try to reduce the range of code points to somethimg like 32 through 255 decimal or “20” through “FF” hex, or to an explicitly given set of characters. Anyway I am afraid you may need a piece of user code to solve the problem a bit more efficiently, except you can assure a (rather small) maximum number of significant characters at the start of any generalized “word”.

As any locale has to use collators regarding the expectations of “standard users” there will be no simple remedy. The question is interesting, however, and I do not complain about the time I used. I just did not wnat to simply waste time, not knowing the exact goal.

Maybe I’m wrong but I can’t see those characters at the end, using Danish as language for default style.


It’s possible create your own sort, put the characters in the order you like in a column, select it,
Menu/Tools/Options/LIbreOffice calc/Sort List - Copy list from
selected range is there, click Copy, the list is added.
To use it, it can be select in Menu/Data/Sort - Options - Custom sort order.

@hpekristiansen’s concern were the letters Æ, æ; Ø, ø; Å, å. He gave a latin transcription.

No my concern is actually not æ,ø and å, but the dipthongs (ae, oe and aa) see edit.

You do do not see it, because the problem is not single chars(glyphs) - see my edit.

@hpekristiansen: I still think I understood, but expressed my remark badly. Rectification: You gave a transcription you actually are using for technical purposes.
I do not think the above answer will help much. In fact I do not even understand it clearly. The workaround I designed myself is rather complicated, however. I will try to simplify it, and come back to this as soon as I can afford the time.

You should look at this Alfabetiseringsregler for danske biblioteker og bibliografier
As far as I can see, only “aa” which is sort like “å” will give you problems, so why not just use English as sorting language for your special purpose.

Jens S

All I want is a language independent sorting. I do not want or care about the danish sorting rules - they are wrong for my purpose. Maybe the best I can do is to use english, but I believe that can affect the sorting in other ways.