chiark / gitweb /
metadata: always open metadata files in UTF-8
authorDaniel Martí <mvdan@mvdan.cc>
Thu, 25 Feb 2016 00:12:23 +0000 (00:12 +0000)
committerDaniel Martí <mvdan@mvdan.cc>
Fri, 11 Mar 2016 13:27:01 +0000 (13:27 +0000)
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.

fdroidserver/metadata.py

index 0112a0ec1b50451455e342cad634e9e455b7aefc..d69e9074cd899b1ea7908a4f748d7df10d5c8992 100644 (file)
@@ -705,7 +705,7 @@ def parse_srclib(metadatapath):
     if not os.path.exists(metadatapath):
         return thisinfo
 
-    metafile = open(metadatapath, "r")
+    metafile = open(metadatapath, "r", encoding='utf-8')
 
     n = 0
     for line in metafile:
@@ -920,7 +920,7 @@ def parse_metadata(metadatapath):
     app.metadatapath = 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':
             parse_txt_metadata(mf, app)
         elif ext == 'json':