From e090267a175d2f2d52128c780108835f36d1ef1e Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Sun, 18 Feb 2018 15:23:39 +0100 Subject: [PATCH] Always import XDG desktop files as utf8 Don't rely on them being entirely ASCII or the system locale. --- MenuXDGCheck.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MenuXDGCheck.py b/MenuXDGCheck.py index 66912ea..d4418a9 100644 --- a/MenuXDGCheck.py +++ b/MenuXDGCheck.py @@ -6,6 +6,7 @@ # http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html # +import codecs import os try: import ConfigParser as cfgparser @@ -30,7 +31,7 @@ class MenuXDGCheck(AbstractCheck.AbstractFilesCheck): def parse_desktop_file(self, pkg, root, f, filename): cfp = cfgparser.RawConfigParser() try: - with open(f, 'rb') as inputf: + with codecs.open(f, encoding='utf-8') as inputf: cfp.readfp(inputf, filename) except cfgparser.DuplicateSectionError as e: printError( -- 2.16.1