From 0370fbcbadab88bdfc8fac5f250ba470c7bc1960 Mon Sep 17 00:00:00 2001 From: Denis Ryabyy Date: Thu, 8 Jun 2017 14:13:26 +0300 Subject: [PATCH] Add utf-8 as default ldap3 encoding --- synapse_ldap_password_provider.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/synapse_ldap_password_provider.py b/synapse_ldap_password_provider.py index 3138be2..05301f3 100644 --- a/synapse_ldap_password_provider.py +++ b/synapse_ldap_password_provider.py @@ -28,6 +28,14 @@ LDAP_AUTH_SIMPLE = ldap3.AUTH_SIMPLE except AttributeError: LDAP_AUTH_SIMPLE = ldap3.SIMPLE + + try: + ldap3.set_config_parameter('DEFAULT_ENCODING', 'UTF-8') + except AttributeError: + pass + except ldap3.core.exceptions.LDAPConfigurationParameterError: + pass + except ImportError: ldap3 = None pass