Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/python-nbxmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hörist <philipp@hoerist.com>2018-04-13 01:30:47 +0300
committerPhilipp Hörist <philipp@hoerist.com>2018-04-13 01:30:47 +0300
commita1e8cee482709318a2fc4b9486b4ccc59768532c (patch)
treea0742d6afe0666602bad2b2d56c0d895f8bfc719
parent56848a8e0ab6fd13a2d73f22c3ea9bddb37f4de7 (diff)
Fix parsing utf8 cert files
Fixes #51
-rw-r--r--nbxmpp/tls_nb.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/nbxmpp/tls_nb.py b/nbxmpp/tls_nb.py
index 32b79ef..6405ed6 100644
--- a/nbxmpp/tls_nb.py
+++ b/nbxmpp/tls_nb.py
@@ -24,6 +24,7 @@ from .plugin import PlugIn
import sys
import os
import time
+import io
import traceback
@@ -337,7 +338,10 @@ class NonBlockingTLS(PlugIn):
if not os.path.isfile(cert_path):
return
try:
- f = open(cert_path)
+ if sys.version_info[0] > 2:
+ f = open(cert_path, encoding='utf-8')
+ else:
+ f = io.open(cert_path, encoding='utf-8')
except IOError as e:
log.warning('Unable to open certificate file %s: %s' % \
(cert_path, str(e)))