Forces utf-8 encoding of opened files

This commit is contained in:
Maxime Bombar 2018-12-30 00:33:54 +01:00
parent d8499579e3
commit f40a8d54fe

View file

@ -35,10 +35,10 @@ def generate(api_client):
template = env.get_template('templates/list_alias')
aliases_rendered = template.render(data=all_users)
fichier = open(path+'/generated/aliases','w')
fichier = open(path+'/generated/aliases','w', encoding='utf-8')
if os.path.isfile(path+'/aliases_local'): # if a local aliases file exist, add it's content at the beginning
local = open(path+'/aliases_local','r')
local = open(path+'/aliases_local','r', encoding='utf-8')
for line in local.readlines():
fichier.write(line)
local.close()
@ -50,10 +50,10 @@ def generate(api_client):
template = env.get_template('templates/list_virtual')
virtuals_rendered = template.render(data=all_users)
fichier = open(path+'/generated/virtual','w')
fichier = open(path+'/generated/virtual','w', encoding='utf-8')
if os.path.isfile(path+'/virtuals_local'): # if a local aliases file exist, add it's content at the beginning
local = open(path+'/virtuals_local','r')
local = open(path+'/virtuals_local','r', encoding='utf-8')
for line in local.readlines():
fichier.write(line)
local.close()