I am currently trying to write a Python 3 module that can conveniently serve me the Windows internal tool "diskpart". Now I have the problem that the output of the tool always depends on the system language.
Does anyone know how I can get it to display these umlauts correctly as well?
If I start "diskpart" separately in a command line and enter the command there, all umlauts are displayed correctly. enter image description here
Here is the call in my Python source code:
try:
proc = subprocess.Popen(['diskpart'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
# Send command to diskpart and read output
stdout, stderr = proc.communicate(input=diskpart_command)
if proc.returncode == 0:
logger.info(f"Diskpart command executed successfully: {diskpart_command}")
return stdout
else:
error_message = f"Error executing diskpart: {stderr}"
logger.error(error_message)
return error_message
Here is the current output of my application: enter image description here