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):
|
def read(self, filename):
|
||||||
log.debug(">>> Trying to parse: %s" % filename)
|
log.debug(">>> Trying to parse: %s" % filename)
|
||||||
|
|
||||||
if ConfigParser.read(self, filename):
|
for enc in ('utf-8', None):
|
||||||
self.filenames = filename
|
try:
|
||||||
|
if ConfigParser.read(self, filename, encoding=enc):
|
||||||
|
self.filenames = filename
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
continue
|
||||||
|
break
|
||||||
|
|
||||||
return self.filenames
|
return self.filenames
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user