From: Daniel Martí Date: Mon, 4 Jan 2016 17:24:58 +0000 (+0100) Subject: common: fix str fetching from manifest xml X-Git-Tag: 0.7.0~86^2~25 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=dd8ad7a4fd54d14c8f19a067d1f1a1a4ed279ac3;p=fdroidserver.git common: fix str fetching from manifest xml --- diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 8c71a230..00c3e2f6 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -952,7 +952,7 @@ def retrieve_string(app_dir, string, xmlfiles=None): if element.text is None: return "" s = XMLElementTree.tostring(element, encoding='utf-8', method='text') - return s.strip() + return s.decode('utf-8').strip() for path in xmlfiles: if not os.path.isfile(path): @@ -1000,7 +1000,7 @@ def fetch_real_name(app_dir, flavours): continue if "{http://schemas.android.com/apk/res/android}label" not in app.attrib: continue - label = app.attrib["{http://schemas.android.com/apk/res/android}label"].encode('utf-8') + label = app.attrib["{http://schemas.android.com/apk/res/android}label"] result = retrieve_string_singleline(app_dir, label) if result: result = result.strip() @@ -1112,15 +1112,15 @@ def parse_androidmanifests(paths, app): try: xml = parse_xml(path) if "package" in xml.attrib: - s = xml.attrib["package"].encode('utf-8') + s = xml.attrib["package"] if app_matches_packagename(app, s): package = s if "{http://schemas.android.com/apk/res/android}versionName" in xml.attrib: - version = xml.attrib["{http://schemas.android.com/apk/res/android}versionName"].encode('utf-8') + version = xml.attrib["{http://schemas.android.com/apk/res/android}versionName"] base_dir = os.path.dirname(path) version = retrieve_string_singleline(base_dir, version) if "{http://schemas.android.com/apk/res/android}versionCode" in xml.attrib: - a = xml.attrib["{http://schemas.android.com/apk/res/android}versionCode"].encode('utf-8') + a = xml.attrib["{http://schemas.android.com/apk/res/android}versionCode"] if string_is_integer(a): vercode = a except Exception: