Hi
I believe there is an encoding-problem with ldap.explode_dn, if I give him =
an=20
utf8-string with excaped umlauts I get an latin with broken escapes:
>>> dn=3Du'uid=3Dl=F6l=F6,cn=3Dbl=F6'
>>> dn
u'uid=3Dl\xf6l\xf6,cn=3Dbl\xf6'
>>> ldap.explode_dn(dn)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.3/site-packages/ldap/functions.py", line 117, in=20
explode_dn
return _ldap_function_call(_ldap.explode_dn,dn,notypes)
File "/usr/lib/python2.3/site-packages/ldap/functions.py", line 57, in=20
_ldap_function_call
result =3D func(*args,**kwargs)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in positio=
n=20
5: ordinal not in range(128)
>>> ldap.explode_dn(dn.encode('utf8'))
['uid=3Dl\\C3\\B6l\\C3\\B6', 'cn=3Dbl\\C3\\B6']
>>> ldap.explode_dn(dn.encode('utf8'))[0].decode('utf8')
u'uid=3Dl\\C3\\B6l\\C3\\B6'
>>> dn.encode('utf8').decode('utf8')
u'uid=3Dl\xf6l\xf6,cn=3Dbl\xf6
Is this by design, by mistake or a bug in the OpenLdap-Libs?
Regards
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
|