From: Ingo S. <st...@un...> - 2005-05-03 16:55:48
|
OK, got it -- but it was't obvious...: modlist=3D[(ldap.MOD_REPLACE,"description","hall=F6le".decode('latin').enco= de('utf8'))] Greetings Ingo Am Dienstag, 3. Mai 2005 09:41 schrieb Ingo Steuwer: > Am Montag, 2. Mai 2005 20:22 schrieb Michael Str=F6der: > > Ingo Steuwer wrote: > > > modlist=3D[(ldap.MOD_REPLACE,"description",[u"hall=F6le".encode('ISO-= 8859-1 > > >') ])] lo.modify_s("CN=3Dmoreusers,CN=3DUsers,%s"%ldap_base,modlist) > > > > LDAPv3 mandates use of Unicode with UTF-8 encoding. You are accessing > > Active Directory via its LDAPv3 interface. Hence it expects UTF-8. > > > > > It is documented that Active Directory uses ISO-8859-1 and not utf8 > > > (like Openldap an others). > > > > I doubt that. Well, depends on what "Active Directory uses ISO-8859-1" > > really means... > > This was mentioned in a documentation of a python-ldap-based tool a can't > find anymore... google stuff. > > > But the charset of the internal storage of AD is not relevant when > > accessing it through LDAPv3. > > > > > So, is this a python-ldap or openldap-problem > > > > Nope. The applications using python-ldap are responsible to provide the > > proper charset and encoding at the API level. > > [..] > > > I've tried it. It works for me with UTF-8. > > Just to be sure: You tried it which way? My experiences are that > python-ldap doesn't allow the use of unicode in a modlist (see Exception = in > my first mail, "expected a string in the list"). Which python-version do > you use? > > Furthermore it seems to me that python-ldap does not use unicode internal= y. > If I read from AD I get unicode strings which are handled by python like > Latin -- which means I have to convert them like "unicode(value,'utf8')". > I expected that modlist will need also unicode as normal strings but that > will give me the other conversion-exception ("ordinal not in range(128)"). > > Regards > Ingo Steuwer > > > Ciao, Michael. =2D-=20 Ingo Steuwer st...@un... fon: +49 421 22 232- 0 Entwicklung Linux for Your Business Univention GmbH http://www.univention.de/ fax: +49 421 22 232-99 |