Qt检测Unicode命令行参数为问号。

问题描述 投票:0回答:1

有时,当我建立一个Qt C++应用程序(MinGW,Qt 5.7.0)并在Windows 10中打开它的参数时,它检测到Unicode参数为问号。我不知道是什么时候发生的,但我认为这取决于参数的长度和参数中是否有白格。

例如,我使用QCommandLine测试了一下。

>app.exe سلام
receives: سلام

>app.exe سلاممممم
receives: سلاممممم

>app.exe سلامممممم
receives: ?????????

>app.exe d:\خطا
receives: d:\???

>app.exe "d:\خطا دار"
receives: d:\خطا دار

>app.exe C:\Users\Reza\Desktop\خطا.txt
receives: C:\Users\Reza\Desktop\???.txt

>app.exe C:\Users\Default\Desktop\خطا.txt
receives: C:\Users\Default\Desktop\خطا.txt

我测试了QCommandLineParser和app.arguments(),但都有同样的问题。

c++ qt unicode command-line arguments
1个回答
0
投票

这是MinGW编译器的globbing过程中的一个问题。根据 QTBUG-84002MinGW提示可以通过在上面添加这段代码来解决。main() 职能。

extern int _CRT_glob = 0; /* 0 turns off globbing; 1 turns it on */ 
© www.soinside.com 2019 - 2024. All rights reserved.