From: <OHU...@sp...> - 2003-11-24 18:41:22
|
Hello, since changing to python 2.3.2, OpenLDAP 2.1.23 and python-ldap-2.0.0pre15 I have problems with explode_dn(), related to diacritics; as You can see: Python 2.3.2 (#1, Oct 26 2003, 16:43:30) [GCC 3.3.1] on sunos5 Type "help", "copyright", "credits" or "license" for more information. >>> import ldap >>> dn="uid=ascii,l=München_iso-8859-1" >>> ldap.explode_dn(dn) ['uid=ascii'] >>> ldap.explode_dn(dn.decode('latin')) Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/local/lib/python2.3/site-packages/ldap/functions.py", line 84, in explode_dn return _ldap_function_call(_ldap.explode_dn,dn,notypes) File "/usr/local/lib/python2.3/site-packages/ldap/__init__.py", line 62, in _ldap_function_call result = apply(func,args,kwargs) UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 13: ordinal not in range(128) >>> ldap.explode_dn(dn.decode('latin').encode('utf')) ['uid=ascii', 'l=M\\C3\\BCnchen_iso-8859-1'] >>> vgl=ldap.explode_dn(dn.decode('latin').encode('utf'))[1] >>> vgl 'l=M\\C3\\BCnchen_iso-8859-1' >>> vgl=="l=München_iso-8859-1".decode('latin').encode('utf8') False In the last working versions, I didn't need to encode or decode the strings. Beeing very RFC-strict I would have to use utf-8 encoding. But the result also should be utf-8 encoded, which isn't the case. Any ideas? Kind Regards Eckard |