diff --git a/zenmap/zenmapCore/Diff.py b/zenmap/zenmapCore/Diff.py index 070f5f48c..13e4c4b94 100644 --- a/zenmap/zenmapCore/Diff.py +++ b/zenmap/zenmapCore/Diff.py @@ -121,7 +121,7 @@ class NdiffCommand(subprocess.Popen): filename_b ] self.stdout_file = tempfile.TemporaryFile( - mode="r", + mode="r", encoding="utf-8", prefix=APP_NAME + "-ndiff-", suffix=".xml" ) @@ -131,7 +131,7 @@ class NdiffCommand(subprocess.Popen): subprocess.Popen.__init__( self, command_list, - universal_newlines=True, + universal_newlines=True, encoding="utf-8", stdout=self.stdout_file, stderr=subprocess.PIPE, env=env, diff --git a/zenmap/zenmapCore/NmapCommand.py b/zenmap/zenmapCore/NmapCommand.py index 941afcdcf..3fe98d7c1 100644 --- a/zenmap/zenmapCore/NmapCommand.py +++ b/zenmap/zenmapCore/NmapCommand.py @@ -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, diff --git a/zenmap/zenmapGUI/ScriptInterface.py b/zenmap/zenmapGUI/ScriptInterface.py index 3afd2ebaa..e9d3a065f 100644 --- a/zenmap/zenmapGUI/ScriptInterface.py +++ b/zenmap/zenmapGUI/ScriptInterface.py @@ -226,7 +226,8 @@ class ScriptInterface: # Separate stderr to avoid breaking XML parsing with "Warning: File # ./nse_main.lua exists, but Nmap is using...". stderr = tempfile.TemporaryFile( - mode="r", prefix=APP_NAME + "-script-help-stderr-") + mode="r", prefix=APP_NAME + "-script-help-stderr-", + encoding="utf-8") log.debug("Script interface: running %s" % repr(command_string)) nmap_process = NmapCommand(command_string) try: