Utils: Add python2 cp65001 compat

git-bash ptty on Windows uses cp65001 by default. Attempting to
decode this codepage in cpython < 3.3 will fail as the encoding
is unsupported. cp65001 is an alias for utf8 on Windows and is
implemented as such since cpython > 3.8. Use this to provide
minimal compatibility for cp65001 to waf running under python2.
This commit is contained in:
Andrew Malachowski 2022-09-01 12:16:28 -05:00
parent c9929238ee
commit fa8ff34a64
1 changed files with 2 additions and 0 deletions

View File

@ -452,6 +452,8 @@ def console_encoding():
pass
else:
if codepage:
if 65001 == codepage and sys.version_info < (3, 3):
return 'utf-8'
return 'cp%d' % codepage
return sys.stdout.encoding or ('cp1252' if is_win32 else 'latin-1')