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
1 changed files with 4 additions and 1 deletions

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: