Handling of Unicode objects (was: start tls)

Michael Ströder michael at stroeder.com
Thu Aug 16 17:24:51 CEST 2001

Steffen Ries wrote:
> attached is a small (experimental) patch, which enables
> 'start_tls_s()' in python-ldap. The patch requires OpenLDAP 2.0.x (I
> tested it only against 2.0.11 on Redhat 6.2).
> I included Konstanin's patches and the memory leak fixes and have run
> the diff against the current CVS version. David's CIDict patches
> are not included, so I disabled CIDict to get it running with
> python2.1.

BTW: It seems that in opposite to the former python-ldap Unicode
strings are accepted by e.g. the modify() call when these patches
are applied.

In the beginning I considered this also to be a good idea. But now I
think this is flawed since we don't have a way to define how the
Unicode objects are encoded to strings. Note that this would require
knowledge about the syntax of a certain attribute type => the LDAP
application should handle that.

If you examine RFC2251 (Lightweight Directory Access Protocol (v3))
you will notice that all transmitted strings are encoded as OCTET
STRING no matter what attribute value they contain. Therefore the
best bet seems to me to solely accept type('') at python-ldap's API
level for attribute values. The calling application should be
responsible for handle Unicode objects.

Ciao, Michael.

More information about the python-ldap mailing list