public inbox for libc-locales@sourceware.org
 help / color / mirror / Atom feed
* Weird case-insensitive collation
@ 2006-10-19 11:35 Ludovic Courtès
  2006-10-19 23:54 ` "Reshat Sabiq (Reşat)"
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2006-10-19 11:35 UTC (permalink / raw)
  To: libc-locales

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-10-29 21:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-19 11:35 Weird case-insensitive collation Ludovic Courtès
2006-10-19 23:54 ` "Reshat Sabiq (Reşat)"
2006-10-20  9:41   ` Ludovic Courtès
2006-10-23 21:59   ` Ludovic Courtès
2006-10-29 21:18     ` "Reshat Sabiq (Reşat)"

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).