QProcess 的中文路徑問題

2021-06-27 04:19:51 字數 588 閱讀 1296

要想正確執行,三點

1,傳入的程式路徑不能是亂碼

2,傳入的引數不能是亂碼

3,要呼叫的程式獲得的引數不能是亂碼

是不是亂碼可以用debug view來列印輸出

1,穿入qprocess的引數最好都這樣處理一下。

qtextcodec *code = qtextcodec::codecforname("gb2312");

str::string str = codec->fromunicode(s).data();

qstring t_strdir = qstring(qstring::fromlocal8bit(str.c_str()));    

這個t_strdir 就是中文的了。 //或者你會這樣獲取 qstring programpath = qstring::fromlocal8bit("e:/中文路徑測試/release/hellochinese.exe");

2,引數也同上一步一樣,如果有路徑的話,就這樣處理一下。

3,被呼叫的程式獲取引數那裡這樣子。

qstring t_sourcefile = qstring::fromlocal8bit(argv[1]);

php中文路徑問題

所有面頁,包括空白的都會報類似下面的錯誤。warning unknown failed to open stream no such file or directory in unknown on line 0 fatal error unknown failed opening required ...

Python 中文路徑問題

python中檔案路徑的問題 慎用中文路徑!慎重中文路徑!慎用中文路徑!使用斜槓 c test.txt 不用反斜槓就沒法產生歧義了 將反斜槓符號轉義 c test.txt 因為反斜槓是轉義符,所以兩個 就表示乙個反斜槓符號 使用python的raw string r c test.txt pytho...

中文路徑問題,中文url

在使用rails的webrick過程中碰到中文url問題,原本認為很簡單的事情其實並不簡單。為了了解中文路徑問題,特別在apache,iis下面做了試驗。過程如下 首先要準備好gb2312和utf 8的檔名。這裡使用python來獲得。s gb 我.txt print s gb 我.txt s gb...