From: Ingo S. <st...@un...> - 2005-05-02 16:03:26
|
Hello I've got some encoding-trouble accessing Active Directory with python-ldap= =20 (slightly modified 2.0.6) on linux (openldap-client 2.1.30). I can modify a container-description using umlauts without an Error/Excepti= on: [..] lo.simple_bind_s(login_dn, login_pw) modlist=3D[(ldap.MOD_REPLACE,"description",[u"hall=F6le".encode('ISO-8859-1= ')])] lo.modify_s("CN=3Dmoreusers,CN=3DUsers,%s"%ldap_base,modlist) [..] Search for this container or view it in windows will result the description= =20 "hallle" (umlauts are "cutted"). Using an different encoding (different fro= m=20 ISo-8859-1/Latin) will result in an exception, like this one with unicode: File "/usr/lib/python2.3/site-packages/ldap/ldapobject.py", line 298, in= =20 modify_s msgid =3D self.modify(dn,modlist) File "/usr/lib/python2.3/site-packages/ldap/ldapobject.py", line 295, in= =20 modify return self.modify_ext(dn,modlist,None,None) File "/usr/lib/python2.3/site-packages/ldap/ldapobject.py", line 268, in= =20 modify_ext return=20 self._ldap_call(self._l.modify_ext,dn,modlist,serverctrls,clientctrls) File "/usr/lib/python2.3/site-packages/ldap/ldapobject.py", line 94, in=20 _ldap_call result =3D func(*args,**kwargs) TypeError: ('expected a string in the list', u'hal\xf6le') It is documented that Active Directory uses ISO-8859-1 and not utf8 (like=20 Openldap an others).=20 So, is this a python-ldap or openldap-problem (I know, great chanceto start= an=20 AD-Flamewar)? Any experiences/solutions? Thanks! Ingo Steuwer =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 |