Perhaps you should use QString::localeAwareCompare() ? BR
Fabrice > -----Ursprüngliche Nachricht----- > Von: Interest <interest-boun...@qt-project.org> Im Auftrag von Hamish > Moffatt > Gesendet: Freitag, 8. Mai 2020 08:27 > An: Qt Interest <interest@qt-project.org> > Betreff: [Interest] unexpected result from QString::compare > > I'm trying to sort a list of strings where umlauts are involved, and not > getting > the answer I expect from QString::compare(). My sample code is: > > auto a = QStringLiteral("Äbc"); > auto b = QStringLiteral("BCD"); > auto c = a.compare(b); > qDebug() << a << b << c; > > This produces the output: > > "Äbc" "BCD" 130 > > which indicates that Äbc should be sorted after "BCD". > > I get the same result when I load the strings through QTranslator so I don't > believe there's any editor/encoding issue going on. > > I seem to get the right result when I let QListWidget sort the items for me > though. > > > What am I missing? > > > thanks, > > Hamish > > > _______________________________________________ > Interest mailing list > Interest@qt-project.org > https://lists.qt-project.org/listinfo/interest _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest