[Freeipa-devel] python-ldap has unicode issues
Kevin McCarthy
kmccarth at redhat.com
Fri Aug 17 22:21:33 UTC 2007
Apparently this is a well known (and debated) issue. See
http://sourceforge.net/mailarchive/message.php?msg_id=71fe4e760707200552w648b6fc8v21770939525c14b9%40mail.gmail.com
> Today passing unicode argument to ldap functions raise an exception,
> then no accidents is possible :-) On the other side, with unicode
> support, things could accidentally work as expected. But this is only
> speculation about witch inconvenient is the worst.
If I translate the strings using s = s.encode('utf-8'), it makes it into
the ldap database just fine:
http://pbnj.usersys.redhat.com:8080/usershow?uid=haoren
The strings that come back from ldap are utf-8 encoded, and will "work"
execpt that the length will be wrong. e.g.: 好 will report a length of
3 instead of one, until we encode that back to unicode strings using
s = unicode(s, 'utf-8')
-Kevin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2228 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20070817/cd5ef166/attachment.bin>
More information about the Freeipa-devel
mailing list