Re: [evolution-patches] [addressbook] Patch for a bug in "By Company" view (case sensitive grouping)
- From: Tor Lillqvist <tml novell com>
- To: Devashish <sdevashish novell com>
- Cc: evolution-patches gnome org
- Subject: Re: [evolution-patches] [addressbook] Patch for a bug in "By Company" view (case sensitive grouping)
- Date: Wed, 14 Sep 2005 16:03:08 +0300
On on, 2005-09-14 at 17:59 +0530, Devashish wrote:
> Hi,
>
> Changed the compare type for Organization to stringcase. This new type
> has been defined for performing case insensitive string compares.
I guess you didn't notice my recent blogging about strcasecmp() ;-)
Using strcasecmp() is wrong. It's behaviour is undefined for non-ASCII
bytes according to the Single UNIX specification. (In glibc, it
apparently simply ignores non-ASCII bytes. In other implementations, it
might even give false positives.)
g_ascii_strcasecmp() would be better (at least one knows for sure what
it does on all platforms, it ignores non-ASCII like strcasecmp() in
glibc).
But ignoring non-ASCII is not very friendly, is it? The strings we are
comparing presumably are known to be in UTF-8, so what we want is case
insensitive, normalized, and locale-sensitive UTF-8 comparison. There
already is code for that in Evolution. One function is
e_utf8_casefold_collate_len() in addressbook/util/eab-book-util.c .
There might be other similar functions, I think I have seen several, or
maybe those were in e-d-s.
--tml
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]