use explicit utf-8 encoding when opening files in text mode
This commit is contained in:
@@ -89,7 +89,7 @@ def get_payment_request(url):
|
||||
error = "payment URL not pointing to a valid server"
|
||||
elif u.scheme == 'file':
|
||||
try:
|
||||
with open(u.path, 'r') as f:
|
||||
with open(u.path, 'r', encoding='utf-8') as f:
|
||||
data = f.read()
|
||||
except IOError:
|
||||
data = None
|
||||
@@ -385,9 +385,9 @@ def check_ssl_config(config):
|
||||
from . import pem
|
||||
key_path = config.get('ssl_privkey')
|
||||
cert_path = config.get('ssl_chain')
|
||||
with open(key_path, 'r') as f:
|
||||
with open(key_path, 'r', encoding='utf-8') as f:
|
||||
params = pem.parse_private_key(f.read())
|
||||
with open(cert_path, 'r') as f:
|
||||
with open(cert_path, 'r', encoding='utf-8') as f:
|
||||
s = f.read()
|
||||
bList = pem.dePemList(s, "CERTIFICATE")
|
||||
# verify chain
|
||||
@@ -405,10 +405,10 @@ def check_ssl_config(config):
|
||||
|
||||
def sign_request_with_x509(pr, key_path, cert_path):
|
||||
from . import pem
|
||||
with open(key_path, 'r') as f:
|
||||
with open(key_path, 'r', encoding='utf-8') as f:
|
||||
params = pem.parse_private_key(f.read())
|
||||
privkey = rsakey.RSAKey(*params)
|
||||
with open(cert_path, 'r') as f:
|
||||
with open(cert_path, 'r', encoding='utf-8') as f:
|
||||
s = f.read()
|
||||
bList = pem.dePemList(s, "CERTIFICATE")
|
||||
certificates = pb2.X509Certificates()
|
||||
|
||||
Reference in New Issue
Block a user