REG:python-ldap able to handle unicode characters

Michael Ströder michael at stroeder.com
Sun Aug 3 22:08:38 CEST 2008


deepti jawalkar wrote:
> well these are my 2 cases :
> 
> *with python-ldap *: so in this case it works even though the object i 
> am passing has unicode characters in it's distinguished name
> eg: CN=Sen-po 胡森� 
> (senpo),OU=Users,OU=TPE,OU=Offices,DC=corp,DC=google,DC=com

Well, *I* can't read this distinguished name. I don't have the necessary 
fonts and installed and I don't understand them anyway. ;-)

> i can print the distinguished name without encoding it in utf-8 format 
> and also remove or add this user to a group.

Off course you can pass around UTF-8-encoded Unicode strings. But you 
have to invoke .decode() and .encode() in your application code (e.g. 
like my web2ldap does). python-ldap does *never* invoke these methods 
internally.

> Can you let me know how exactly is this happening in python ldap and how 
> is it able to add and remove accounts with unicode characters.

You can always just treat the DNs opaque. ;-)

Ciao, Michael.



More information about the python-ldap mailing list