From d99ae442c9561ba1fe95b7e6125b5ea788752952 Mon Sep 17 00:00:00 2001 From: dmiller Date: Mon, 9 Jun 2025 15:20:42 +0000 Subject: [PATCH] Use UTF-8 to read config file. Fixes #3116 --- zenmap/zenmapCore/UmitConfigParser.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/zenmap/zenmapCore/UmitConfigParser.py b/zenmap/zenmapCore/UmitConfigParser.py index f48a6b88d..6bb948971 100644 --- a/zenmap/zenmapCore/UmitConfigParser.py +++ b/zenmap/zenmapCore/UmitConfigParser.py @@ -78,8 +78,13 @@ class UmitConfigParser(ConfigParser): def read(self, filename): log.debug(">>> Trying to parse: %s" % filename) - if ConfigParser.read(self, filename): - self.filenames = filename + for enc in ('utf-8', None): + try: + if ConfigParser.read(self, filename, encoding=enc): + self.filenames = filename + except UnicodeDecodeError: + continue + break return self.filenames