yazwas
26th August 2011, 11:45
Good day
I'm trying to sort a list of Khmer words, but so far I'm not successful. I'm using UTF-8 and qSort to do the job, but there is something wrong, or something missing.
(the below code worked ok for English and French)
bool caseInsensitiveLessThan(const QString &s1, const QString &s2)
{
return s1.trimmed().toLower() < s2.trimmed().toLower();
}
void mySort(QStringList &list)
{
qDebug() << "unsorted list: " << list;
qSort(list.begin(), list.end(), caseInsensitiveLessThan);
qDebug() << " sorted list: " << list;
}
This is an example list I have that is sorted, and should not be resorted when using the sort code.
ក1, កáŸ2, កក3, កក់4, កករ5, កកាáž6, កកាយ7, áž€áž€áž·áž…áž€áž€áž»á …8, កកិáž9, កកិល10
but when using my sorting code (above), I'm getting this list.
ក1, កក3, កករ5, កកាáž6, កកាយ7, áž€áž€áž·áž…áž€áž€áž»á …8, កកិáž9, កកិល10, កក់4, កáŸ2
Any suggestions are most welcomed?
Thank you
I'm trying to sort a list of Khmer words, but so far I'm not successful. I'm using UTF-8 and qSort to do the job, but there is something wrong, or something missing.
(the below code worked ok for English and French)
bool caseInsensitiveLessThan(const QString &s1, const QString &s2)
{
return s1.trimmed().toLower() < s2.trimmed().toLower();
}
void mySort(QStringList &list)
{
qDebug() << "unsorted list: " << list;
qSort(list.begin(), list.end(), caseInsensitiveLessThan);
qDebug() << " sorted list: " << list;
}
This is an example list I have that is sorted, and should not be resorted when using the sort code.
ក1, កáŸ2, កក3, កក់4, កករ5, កកាáž6, កកាយ7, áž€áž€áž·áž…áž€áž€áž»á …8, កកិáž9, កកិល10
but when using my sorting code (above), I'm getting this list.
ក1, កក3, កករ5, កកាáž6, កកាយ7, áž€áž€áž·áž…áž€áž€áž»á …8, កកិáž9, កកិល10, កក់4, កáŸ2
Any suggestions are most welcomed?
Thank you