I've recently found a problem with the Evolution address book's
handling of LDAP data that is not UTF8-encoded: any LDAP attribute
string containing non-UTF8 characters is truncated at the first such
character.
To see this in action, create an LDAP entry with a name containing
non-UTF8, non-ASCII characters. Pointing Evolution to this directory
server will result in the name being truncated - this affects both the
book and autocomplete views.
I have built (and attached) a patch against Evolution 1.4.5 that works
(read 'kludges') around this by assuming that an invalid UTF8 string is
ISO8859-1-encoded and converting it to UTF8, but I am unsure how to go
about determining a string's encoding and converting it appropriately in
the general case.
Any advice or pointers would be much appreciated.
Thanks,
Scott MacLean
<[EMAIL PROTECTED]>
diff -uNr evolution-1.4.5.orig/addressbook/backend/ebook/e-card-simple.c evolution-1.4.5/addressbook/backend/ebook/e-card-simple.c
--- evolution-1.4.5.orig/addressbook/backend/ebook/e-card-simple.c 2004-02-02 16:39:52.000000000 -0500
+++ evolution-1.4.5/addressbook/backend/ebook/e-card-simple.c 2004-02-02 16:43:29.000000000 -0500
@@ -1077,8 +1077,14 @@
ECardSimpleInternalType type = field_data[field].type;
ECardAddrLabel *address;
ECardPhone *phone;
+ char *data_cache = data;
int style;
simple->changed = TRUE;
+
+ /* assume non-UTF strings are Western European for LDAP's sake? */
+ if (!g_utf8_validate(data, -1, NULL))
+ data = e_utf8_from_charset_string("iso-8859-1", data);
+
switch (field) {
case E_CARD_SIMPLE_FIELD_FULL_NAME:
case E_CARD_SIMPLE_FIELD_ORG:
@@ -1135,6 +1141,9 @@
}
break;
}
+
+ if (data != data_cache)
+ g_free(data);
}
ECardSimpleType e_card_simple_type (ECardSimple *simple,