metadata: always open metadata files in UTF-8

For some reason, Python uses whatever encoding the system is using via a
locale. Since CI uses an ascii locale, stuff breaks. I can't find a way
to make all of fdroidserver ignore the locale and just use UTF-8, so for
now force it where it's bothering CI.
This commit is contained in:
Daniel Martí 2016-02-25 00:12:23 +00:00
parent 23a950bd00
commit a023a235a2

View file

@ -705,7 +705,7 @@ def parse_srclib(metadatapath):
if not os.path.exists(metadatapath): if not os.path.exists(metadatapath):
return thisinfo return thisinfo
metafile = open(metadatapath, "r") metafile = open(metadatapath, "r", encoding='utf-8')
n = 0 n = 0
for line in metafile: for line in metafile:
@ -920,7 +920,7 @@ def parse_metadata(metadatapath):
app.metadatapath = metadatapath app.metadatapath = metadatapath
app.id, _ = fdroidserver.common.get_extension(os.path.basename(metadatapath)) app.id, _ = fdroidserver.common.get_extension(os.path.basename(metadatapath))
with open(metadatapath, 'r') as mf: with open(metadatapath, 'r', encoding='utf-8') as mf:
if ext == 'txt': if ext == 'txt':
parse_txt_metadata(mf, app) parse_txt_metadata(mf, app)
elif ext == 'json': elif ext == 'json':