From 5be154b9e2f66f7d03f1e9366a5f1a5057dcb651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0tampar?= Date: Thu, 30 Jul 2026 18:04:49 +0200 Subject: [PATCH] Fixes diplaying of non-ASCII chars on Windows OS --- lib/core/convert.py | 9 ++++++++- lib/core/settings.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/core/convert.py b/lib/core/convert.py index 39d7028dc..f3927e60d 100644 --- a/lib/core/convert.py +++ b/lib/core/convert.py @@ -637,7 +637,14 @@ def stdoutEncode(value): kb.codePage = kb.codePage or "" - encoding = kb.get("codePage") or getattr(sys.stdout, "encoding", None) or UNICODE_ENCODING + # Python 3.6+ writes to the Windows console via WriteConsoleW (PEP 528), so sys.stdout.encoding + # (typically 'utf-8') renders Unicode that the legacy OEM/ANSI code page from 'chcp' would replace + # with '?'; prefer it there. The chcp-derived code page stays as the fallback (older interpreters, + # PYTHONLEGACYWINDOWSSTDIO, or a console encoding Python could not determine) and for Python 2. + if six.PY3: + encoding = getattr(sys.stdout, "encoding", None) or kb.get("codePage") or UNICODE_ENCODING + else: + encoding = kb.get("codePage") or getattr(sys.stdout, "encoding", None) or UNICODE_ENCODING if six.PY3: if isinstance(value, (bytes, bytearray)): diff --git a/lib/core/settings.py b/lib/core/settings.py index dfc1bfa9c..0bab7f42b 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -20,7 +20,7 @@ from lib.core.enums import OS from thirdparty import six # sqlmap version (...) -VERSION = "1.10.7.251" +VERSION = "1.10.7.252" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)