User sync from AD got error message UnicodeDecodeError

ERPNext version
OS: Centos7.5
Python: 3.6
Bench: 4.1.0
Frappe: 12.x.x-develop
erpnext: 12.x.x-develop

After setup the Active Directory in integration->LDAP. AD user cannot login with message " invalid username or password"
We saw following error message in logs/frappe.log file.

[ERROR] 2019-09-03 18:02:22,388 | /opt/frappe-bench/apps/frappe/frappe/utils/
Could not take error snapshot: startswith first arg must be str or a tuple of str, not bytes
Traceback (most recent call last):
File “/opt/frappe-bench/apps/frappe/frappe/”, line 57, in application
response = frappe.handler.handle()
File “/opt/frappe-bench/apps/frappe/frappe/”, line 21, in handle
data = execute_cmd(cmd)
File “/opt/frappe-bench/apps/frappe/frappe/”, line 56, in execute_cmd
return, **frappe.form_dict)
File “/opt/frappe-bench/apps/frappe/frappe/”, line 1036, in call
return fn(*args, **newargs)
File “/opt/frappe-bench/apps/frappe/frappe/integrations/doctype/ldap_settings/”, line 207, in login
user = ldap.authenticate(frappe.as_unicode(args.usr), frappe.as_unicode(args.pwd))
File “/opt/frappe-bench/apps/frappe/frappe/integrations/doctype/ldap_settings/”, line 169, in authenticate
return self.create_or_update_user(self.convert_ldap_entry_to_dict(user), groups=groups)
File “/opt/frappe-bench/apps/frappe/frappe/integrations/doctype/ldap_settings/”, line 119, in create_or_update_user
File “/opt/frappe-bench/apps/frappe/frappe/model/”, line 229, in insert
File “/opt/frappe-bench/apps/frappe/frappe/model/”, line 461, in _validate
File “/opt/frappe-bench/apps/frappe/frappe/model/”, line 578, in _validate_length
if len(cstr(value)) > max_length:
File “/opt/frappe-bench/apps/frappe/frappe/utils/”, line 342, in cstr
return frappe.as_unicode(s, encoding)
File “/opt/frappe-bench/apps/frappe/frappe/”, line 80, in as_unicode
return text_type(text, encoding)
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x89 in position 0: invalid start byte

Sounds like it is related AD attribute thumbnailPhoto, we have users Photos stored in thumbnailPhoto, if we remove the Photo map in LDAP settings, the issue gone.
So, Please advise how can we fix it.