I'm currently working on a project where I need to run a command in powershell, and part of the output is not in English (Specifically - Hebrew).
For example (a simplified version of the problem), if I want to get the content of my desktop, and there is a filename in Hebrew:
import subprocess
command = "powershell.exe ls ~/Desktop"
print (subprocess.run(command.split(), stdout=subprocess.PIPE).stdout.decode())
This code will raise the following error (Or something similar with a different byte value):
UnicodeDecodeError: 'utf8' codec can't decode byte 0x96 in position 19: invalid start byte
Tried to run it on a different computer, and this was the output:
?????
Any idea why is that and how can I fix it? Tried a lot of things I saw on other questions, but none of them worked for me.