[Zope-CVS] SVN: ldapadapter/trunk/utility.py Not all data is
encoded unicode; some is binary, so leave it alone. Note
Stephan Richter
srichter at cosmos.phy.tufts.edu
Fri May 20 13:56:28 EDT 2005
Log message for revision 30469:
Not all data is encoded unicode; some is binary, so leave it alone. Note
that I found this bug by working with a real LDAP database.
Changed:
U ldapadapter/trunk/utility.py
-=-
Modified: ldapadapter/trunk/utility.py
===================================================================
--- ldapadapter/trunk/utility.py 2005-05-20 17:43:15 UTC (rev 30468)
+++ ldapadapter/trunk/utility.py 2005-05-20 17:56:28 UTC (rev 30469)
@@ -139,7 +139,11 @@
for key, values in entry.items():
# TODO: Can key be non-ascii? Check LDAP spec.
# FIXME: there may be non-textual binary values.
- values[:] = [unicode(v, 'utf-8') for v in values]
+ try:
+ values[:] = [unicode(v, 'utf-8') for v in values]
+ except UnicodeDecodeError:
+ # Not all data is unicode, so decoding does not always work.
+ pass
results.append((dn, entry))
return results
More information about the Zope-CVS
mailing list