Skip to content

Incorrect special character sorting #2573

@vonox7

Description

@vonox7

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:

  • The characters ' and - are before the characters !"#
  • The numbers (0-9) are after all other special characters like : and =
  • The characters ?, + and _ are in the wrong position

The realm sorting documentation has the following missing:

  • Realm sort is case-insensitive (in contrast to Java/Swift greaterThan/smallerThan Operator (< / >))

It seems like realm doesn't comply to any standard (unicode, ascii...) and just sorts all special characters by a random specification and order.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions