Fixes diplaying of non-ASCII chars on Windows OS

This commit is contained in:
Miroslav Štampar 2026-07-30 18:04:49 +02:00
parent 112356ac5c
commit 5be154b9e2
2 changed files with 9 additions and 2 deletions

View file

@ -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)):

View file

@ -20,7 +20,7 @@ from lib.core.enums import OS
from thirdparty import six
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
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)