Weird case-insensitive collation

Ludovic Courtès ludovic.courtes@laas.fr
Fri Oct 20 09:41:00 GMT 2006


Hi,

"Reshat Sabiq (Reşat)" <tatar.iqtelif.i18n@gmail.com> writes:

> I think this function is not locale-aware, so it compares characters'
> integral value, which naturally produces a positive.
> http://opengroup.org/onlinepubs/007908799/xsh/strcasecmp.html
> In the POSIX locale, strcasecmp() and strncasecmp() do upper to lower
> conversions, then a byte comparison. The results are unspecified in
> other locales.

It is true that POSIX is not so clear wrt. locale-dependence.  However,
while it says how the function should behave under the `POSIX' locale,
it does not explicitly mention how it should deal with other locales.

The glibc manual is more explicit in that respect [0]:

  In the standard "C"locale the characters and do not match but in a
  locale which regards these characters as parts of the alphabet they do
  match.

This seems to imply that `strcasecmp ()' knows how to deal with other
locales.

Thanks,
Ludovic.

[0] http://www.gnu.org/software/libc/manual/html_node/String_002fArray-Comparison.html#String_002fArray-Comparison



More information about the Libc-locales mailing list