1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Use UTF-8 to read config file. Fixes #3116

This commit is contained in:
dmiller
2025-06-09 15:20:42 +00:00
parent c58eb84340
commit d99ae442c9

View File

@@ -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