encodings while modify AD with linux-client
steuwer at univention.de
Tue May 3 09:41:39 CEST 2005
Am Montag, 2. Mai 2005 20:22 schrieb Michael Ströder:
> Ingo Steuwer wrote:
> > modlist=[(ldap.MOD_REPLACE,"description",[u"hallöle".encode('ISO-8859-1')
> >])] lo.modify_s("CN=moreusers,CN=Users,%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 internaly. 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)").
> Ciao, Michael.
Ingo Steuwer steuwer at univention.de fon: +49 421 22 232- 0
Entwicklung Linux for Your Business
Univention GmbH http://www.univention.de/ fax: +49 421 22 232-99
More information about the python-ldap