diff --git a/nxc/netexec.py b/nxc/netexec.py index d1e53c69..35d0b38c 100755 --- a/nxc/netexec.py +++ b/nxc/netexec.py @@ -23,7 +23,8 @@ from sys import exit from rich.progress import Progress import platform -sys.stdout.reconfigure(encoding="utf-8") +if sys.stdout.encoding == "cp1252": + sys.stdout.reconfigure(encoding="utf-8") # Increase file_limit to prevent error "Too many open files" if platform.system() != "Windows": diff --git a/tests/e2e_tests.py b/tests/e2e_tests.py index 4aba6af9..3b697abe 100644 --- a/tests/e2e_tests.py +++ b/tests/e2e_tests.py @@ -8,7 +8,8 @@ import os from nxc.paths import TMP_PATH import sys -sys.stdout.reconfigure(encoding="utf-8") +if sys.stdout.encoding == "cp1252": + sys.stdout.reconfigure(encoding="utf-8") script_dir = dirname(abspath(__file__)) run_dir = os.getcwd()