[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: QString::localeAwareCompare() in KDE
From:       André_Wöbbeking <Woebbeking () kde ! org>
Date:       2009-05-28 21:58:00
Message-ID: 200905282358.00903.Woebbeking () kde ! org
[Download RAW message or body]

On Friday 08 May 2009, Peter Penz wrote:
> [...]
>
> > >Is somebody familiar with this topic and knows how I can convince
> > > the unit test to run with the same locale settings as a KDE
> > > application? I tried QLocale::setDefault(...) but the unit test
> > > always passes correctly...
> >
> > This is localeAwareCompare for Unix (which aren't Macs):
> >
> >     int delta = strcoll(toLocal8Bit_helper(data1, length1),
> > toLocal8Bit_helper(data2, length2));
> >
> >     if (delta == 0)
> >         delta = ucstrcmp(data1, length1, data2, length2);
> >     return delta;
> >
> > As you can see, it's basically calling strcoll(3), which is a C
> > library function. Setting the default QLocale will have no effect:
> > you have to set the C library's locale, via setlocale(3).
> >
> > In any case, the sorting you find weird is coming from glibc.
> > There's little we can do.
>
> Thanks Thiago. Too sad that this is not directly in our hands... I'll
> still try to adapt the unit test to use a setLocale(3) call to have
> the same (wrong) behavior like when using it within a KDE
> application. By this we have at least documented a known failure...

Are you sure that this is a failure? AFAIK these are locale sorting 
rules also used in e.g. phone books. Have a look at

http://en.wikipedia.org/wiki/Collation


Cheers,
André
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic