If there is an entry with umlauts in DN and you change or add an attribute (with or without umlaut) the DN is changed. Then the umlauts are corrupted in the DN.
Can you please post example ldif entries for that? Like "what did the item look like before" and "what did it look like after". Also, please tell us which version of GQ you are using.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This seems to happen, because gq hardcodec uses the ISO-8859-1 character set with the default compile time settings. update_formlist() pushes the dn through encode_string, which than tries to convert the dn from iso-8859-1 to utf-8 (which is the default LDAP character set). Since the dn string is already utf-8 this results in the wrong encoding of the dn...
With the patch below the problem goes away for me when locale settings are set to utf-8, but this is only a dirty fix to the symptoms, since the whole encoding.c seems to be somewhat broken...
Logged In: YES
user_id=76622
Originator: NO
Can you please post example ldif entries for that? Like "what did the item look like before" and "what did it look like after". Also, please tell us which version of GQ you are using.
LDIF before
Logged In: YES
user_id=40342
Originator: YES
gq 1.2.1
I put this case into the db:
dn:: Y249R8O8bnRoZXIgTMO2ZmZsZXIsb3U9QWRyZXNzYnVjaCxkYz1mcmV1ZGVuYmVyZyxkYz1
paA==
cn:: R8O8bnRoZXIgTMO2ZmZsZXI=
objectClass: organizationalPerson
objectClass: evolutionPerson
objectClass: inetOrgPerson
objectClass: person
sn:: TMO2ZmZsZXI=
In gq you get the display photo 1.
Then I filled the telephone field. After "Anwenden" the umlauts are destroyed (Photo 2)
The LDIF-Filelooks like:
#
# This file was generated by gq 1.2.1 (http://biot.com/gq/)
# run by egon Sun Jan 20 23:40:29 2008
#
# subtree search on server: ldap://Baldur:389/
# binddn: cn=admin,dc=freudenberg,dc=ih
# searching below: cn=Günther Löffler,ou=Adressbuch,dc=freudenberg,dc=ih
# version: 1
#
dn:: Y249R8ODwrxudGhlciBMw4PCtmZmbGVyLG91PUFkcmVzc2J1Y2gsZGM9ZnJldWRlbmJlcmcs
ZGM9aWg=
objectClass: organizationalPerson
objectClass: evolutionPerson
objectClass: inetOrgPerson
objectClass: person
sn:: TMO2ZmZsZXI=
cn:: R8ODwrxudGhlciBMw4PCtmZmbGVy
telephoneNumber: 345678
File Added: TestBefore
LDIF after input in telephone number
Logged In: YES
user_id=40342
Originator: YES
File Added: TestAfter
Display
Logged In: YES
user_id=40342
Originator: YES
File Added: Bildschirmfoto-GQ-1.png
Logged In: YES
user_id=40342
Originator: YES
File Added: Bildschirmfoto-GQAfter.png
Foto 2
This seems to happen, because gq hardcodec uses the ISO-8859-1 character set with the default compile time settings. update_formlist() pushes the dn through encode_string, which than tries to convert the dn from iso-8859-1 to utf-8 (which is the default LDAP character set). Since the dn string is already utf-8 this results in the wrong encoding of the dn...
With the patch below the problem goes away for me when locale settings are set to utf-8, but this is only a dirty fix to the symptoms, since the whole encoding.c seems to be somewhat broken...
=======================================================================
--- gq-1.2.3-orig/src/encode.c 2007-05-14 18:26:51.000000000 +0200
+++ gq-1.2.3/src/encode.c 2009-07-14 19:04:42.000000000 +0200
@@ -90,12 +90,16 @@
char *out;
size_t outlen;
iconv_t conv;
+ const char *g_codeset;
in = (char *) native_string;
out = ldap_string;
/* len = strlen(in); */
outlen = len * 2 + 1; /* Worst case */
- conv = iconv_open(LDAP_CODESET, gq_codeset);
+
+ g_get_charset(&g_codeset);
+
+ conv = iconv_open(LDAP_CODESET, g_codeset);
if (conv != (iconv_t) (-1)) {
while(len > 0 && outlen > 0) {
================================================