1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 13:11:28 +00:00

Zenmap: Ensure files are opened with UTF-8 encoding

This commit is contained in:
dmiller
2025-03-04 17:06:32 +00:00
parent 068dd4b0df
commit 49c25e6431
3 changed files with 6 additions and 5 deletions

View File

@@ -198,7 +198,7 @@ class NmapCommand(object):
# We don't need a file name for stdout output, just a handle. A
# TemporaryFile is deleted as soon as it is closed, and in Unix is
# unlinked immediately after creation so it's not even visible.
f = tempfile.TemporaryFile(mode="r", prefix=APP_NAME + "-stdout-")
f = tempfile.TemporaryFile(mode="r", prefix=APP_NAME + "-stdout-", encoding="utf-8")
self.stdout_file = f
if stderr is None:
stderr = f
@@ -223,7 +223,7 @@ class NmapCommand(object):
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
self.command_process = subprocess.Popen(command_list, bufsize=1,
universal_newlines=True,
universal_newlines=True, encoding="utf-8",
stdin=subprocess.PIPE,
stdout=f,
stderr=stderr,