cubicweb #3539196 ldapfeed: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 16: ordinal not in range(128) [validation pending]

Our LDAP database contains names with non-ASCII characters.

LDAP servers are UTF-8 encoded (by default or always?) but ldapfeed does not seem to decode from UTF-8. Here is part of the log:

[...]
File "/usr/lib/python2.7/dist-packages/cubicweb/server/sources/datafeed.py", line 256, in after_entity_insertion
sourceparams['parser'].after_entity_copy(entity, sourceparams)
File "/usr/lib/python2.7/dist-packages/cubicweb/sobjects/ldapparser.py", line 178, in after_entity_copy
self._process_email(entity, sourceparams)
File "/usr/lib/python2.7/dist-packages/cubicweb/sobjects/ldapparser.py", line 204, in _process_email
emailextid = userdict['dn'] + '@@' + emailaddr
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 16: ordinal not in range(128)
2014-02-11 12:00:30 - (cubicweb.sources.Imagen) WARNING: some error occured, don't attempt to delete entities
[...]

I'm not certain where that should be fixed. Maybe in ldap2cwattrs()? Maybe change from:
tdict[tattr] = sdict[sattr]
to:
tdict[tattr] = sdict[sattr].decode('utf-8')

prioritynormal
typebug
done in3.17.13
load0.100
load left0.000
closed by#09b4ebb9b0f1 [ldapfeed] fix encode error during initial user import
patch[ldapfeed] fix encode error during initial user import [applied]