This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Locale Bug? - was Re: VERY Strange interaction between strcoll, Qt, and locale
- From: Albert Astals Cid <tsdgeos at terra dot es>
- To: libc-alpha at gnu dot org
- Cc: Andreas Jaeger <aj at suse dot de>
- Date: Sun, 11 Jan 2004 21:52:44 +0100
- Subject: Locale Bug? - was Re: VERY Strange interaction between strcoll, Qt, and locale
- References: <200401100223.09077.tsdgeos@terra.es> <m3oetcc9tu.fsf@gromit.moeb>
Hi, look at the sample code (now completely in C) and the result i get
unit.cpp unitdescriptor.cpp -1
unitdescriptor.cpp unit.cpp 1
unit.h unitdescriptor.cpp 4
unitdescriptor.cpp unit.h -4
I think this is a bug because it is not possible that unit.cpp is lower than
unitdescriptor.cpp and unit.h bigger than unitdescriptor.cpp. Both unit.cpp
and unit.h should be either bigger or lower than unitdescriptor.cpp
(depending on dot value in respect with the letters).
Is this a bug that this mailing list can try to verify/fix? If not who/where
should i report?
Thanks.
Albert.
P.S: I can reproduce the bug also with es_ES instead of ca_ES
A Dissabte 10 Gener 2004 12:38, vàreu escriure:
> Albert Astals Cid <tsdgeos@terra.es> writes:
> > Hi, i have been speaking with Trolltech people with what i though was a
> > Qt (their library) bug, but after both them and me looking at it, it
> > seems it is a very strange interaction between strcoll, Qt, and the
> > current system locale.
> >
> > I send two attached programs.
> >
> > Both are the same except test4 has a QApplication object and test3 has
> > not. Both use strcoll to compare the same strings.
> > Both give the same results with LC_ALL= en BUT if i set LC_ALL=es_ES
> > test3 and test4 give to me DIFFERENT results.
> >
> > Any idea?
> >
> > Thanks for any input on this.
> >
> > Albert.
> >
> > P.S: I'm not subscribed to the list, so please keep me CC'ed
> >
> > P.S: If you are not familiar with Qt a typical line to compile a QT
> > program is gcc -o test4 test4.cpp -I $(QtIncludePath) -L $(QtLibPath)
> > -lqt-mt
>
> Sorry, we're not going to debug problems in qt. Please send a
> self-contained C program that shows the problem.
>
>
> Btw. you're using strcoll but do not call setlocale, this might be the
> problem.
>
> Andreas
#include <locale.h>
int main(int argc, char *argv[])
{
setlocale(LC_COLLATE, "ca_ES");
printf("unit.cpp unitdescriptor.cpp %d\n", strcoll("unit.cpp", "unitdescriptor.cpp"));
printf("unitdescriptor.cpp unit.cpp %d\n", strcoll("unitdescriptor.cpp", "unit.cpp"));
printf("unit.h unitdescriptor.cpp %d\n", strcoll("unit.h", "unitdescriptor.cpp"));
printf("unitdescriptor.cpp unit.h %d\n", strcoll("unitdescriptor.cpp", "unit.h"));
return 0;
}