Skip to content

Commit f58606d

Browse files
committed
Fixes #12
* force the powershell to output utf8 * don't go into text mode with subprocess.Popen (universal_newlines=False) because it will fail to decode the output * decode the output of the powershell command explicitly
1 parent 2560a87 commit f58606d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

windowsapps.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,14 @@ def on_catalog(self):
166166
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
167167
output, err = subprocess.Popen(["powershell.exe",
168168
"-noprofile",
169-
"Get-AppxPackage | ConvertTo-Json"],
169+
"chcp 65001 >$null; Get-AppxPackage | ConvertTo-Json"],
170170
stdout=subprocess.PIPE,
171-
universal_newlines=True,
171+
universal_newlines=False,
172172
shell=False,
173173
startupinfo=startupinfo).communicate()
174174

175175
catalog = []
176-
packages = json.loads(output)
176+
packages = json.loads(output.decode("utf8"))
177177
for package in packages:
178178
try:
179179
catalog.extend(self._create_catalog_item(package))

0 commit comments

Comments
 (0)