Python calls antiword to convert doc file and returns garbled code.

problem description

using python to call antiword to convert doc to txt, it is found that the returned value is garbled, and using antiword on powershell is also garbled. It is no problem to call on git bash

the environmental background of the problems and what methods you have tried

Environment: windows platform, py3.6
tried to change the locale, and tried the-m parameter of antiword, but it didn"t work.

related codes

/ / Please paste the code text below (do not replace the code with pictures)

pipe = subprocess.Popen(
        ["antiword", filename],
        stdout=subprocess.PIPE, 
        stderr=subprocess.PIPE  )

stdout, stderr = pipe.communicate()
return stdout

Oct.15,2021
Menu