Open vonox7 opened 7 years ago
@vonox7 The sorting behaviour you mention is the expected one. I have created https://github.com/realm/realm-java/issues/4527 to clarify. Moreover, I will update the documentation so it is clear tha this is the intended behaviour.
@kneth Thanks for the update. The documentation update explains the intended lowercase/uppercase problem. But the characters like'-!"#:=?+_
ARE in the utf-8 range (0-591). See also https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)#Table_of_characters . I think you missed here my point.
I'm shocked that such divergence from all the existing specs exists for years unresolved...
How am I supposed to sort contacts by name to form a (#) group after a (z)
, if (z) is always the last, no matter which character I use for grouping? Have to appeal to yet another hack to make Realm work.
Hey @nalexn - happy to see someone still cares! We fully understand the frustration when something like this is needed!
We surely would love to get this fixed, and while we hoped for a simple solution by adding full ICU support from the platforms, none of the mobile platforms really support that in an official way, unfortunately (despite earlier promises..). Just including all of ICU is also out of question for size reasons. So it looks like we have to get more inventive and offer some kind of opt-in solution or configuration of sorts so that we don’t blow up the library size significantly for those that don’t need this.
We can’t really promise anything about when we can take that on, but it’s not on our immediate shortlist for now. We have hundreds of good ideas in the backlog and we do try to prioritize features based on user feedback so that we give most people the highest value all the time. So definitely appreciate your "upvote" on this!
In the meantime, did you actually find a workaround? Otherwise happy to help out!
Hi,
We also really would like to be able to control the sorting. I have outlined a suggestion in https://github.com/realm/realm-js/issues/3770, perhaps you could do something along those lines?
The JVM, Swift and all other programming languages (see also unicode specification) mentioned in src/realm/unicode.cpp) define the following character sequence as "sorted:
!"#$%&'()*+,-./123:;<=>?ABCXYZ_abcxyz
In contrast, Realm 3.1.2 considers the following as "sorted":
'- !"#$%&()*,./:;?_+<=>123aAbBcCxXyYzZ
Code for reproduction
The realm sorting algorithm has the following bugs:
'
and-
are before the characters!"#
:
and=
?
,+
and_
are in the wrong positionThe realm sorting documentation has the following missing:
It seems like realm doesn't comply to any standard (unicode, ascii...) and just sorts all special characters by a random specification and order.