This is the mail archive of the libc-locales@sourceware.org mailing list for the GNU libc locales project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Weird case-insensitive collation


Hi,

`strcasecmp ()' behaves wrongly under the `fr_FR' locale.  Consider the
following example program:

  #include <stdlib.h>
  #include <stdio.h>
  #include <locale.h>
  #include <strings.h>

  int
  main (int argc, char *argv[])
  {
    int result;

    if (!setlocale (LC_ALL, "fr_FR.ISO-8859-1"))
      abort ();

    result = strcasecmp ("été", "Hiver");
    printf ("result=%i\n", result);

    return (result < 0) ? 0 : 1;
  }

Under French collation conventions, letter `é' (`e' with acute) comes
before `h'.  Thus, the word "été" should be "lower than" the word
"hiver".  `strcoll ()' returns the right answer (a negative number) but
`strcasecmp ()' wrongfully returns a positive number, regardless of
whether "hiver" is spelt with a capital `H' or not.

Is this a bug or am I missing something?

Thanks,
Ludovic.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]