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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user