Runtime.getRuntime().exec
當被調用的節本有中文輸出的時候,還是亂碼!!!因為Python安裝在Windows環境下的默認編碼格式是GBK!!!
我的解決辦法:在被調用的腳本中增加如下代碼
import io import sys sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8') sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')