2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2025-01-20 23:40:21 +01:00

Decode vswhere output as utf8/replace when cp1252 fails

This commit is contained in:
Thomas Nagy 2017-06-19 20:24:21 +02:00
parent 17cd653136
commit c668663362

View File

@ -457,7 +457,10 @@ def gather_vswhere_versions(conf, versions):
return
if sys.version_info[0] < 3:
txt = txt.decode(sys.stdout.encoding or 'windows-1252')
try:
txt = txt.decode(sys.stdout.encoding or 'cp1252')
except UnicodeError:
txt = txt.decode('utf-8', 'replace')
arr = json.loads(txt)
arr.sort(key=lambda x: x['installationVersion'])
for entry in arr: