开发者

C++/QT - QFileDialog::getOpenFileName filter *.xml disables files with japanese characters in their name

开发者 https://www.devze.com 2023-03-24 04:36 出处:网络
I\'m trying to use a QFileDialog::getOpenFileName with an xml filter defined tr(\"XML Files (*.xml)\") to ask the user to select an XML file.

I'm trying to use a QFileDialog::getOpenFileName with an xml filter defined tr("XML Files (*.xml)") to ask the user to select an XML file.

However, in case there's a file in the directory that has japanese characters in its name ( e.g: ラドクリフ.xml ), the file is shown to be disabled, so the user can开发者_Go百科't select it. Other files, such as a.xml, b.xml are shown to be select-able.

Why is this happening ? Is there a way to fix this ?

Thanks!


The file is not "ラドクリフ.xml" it is "ラドクリフ.xml" note the xml at the end of the filename is not ASCII; they are full width Roman letters i.e. UniCode codepoints 0xFF00-0xFFEF.

The fix is for your users to switch back to ASCII input when typing the .xml at the end, or if your software is localised for Japanese add full width "*.xml" to your list of filters.

0

精彩评论

暂无评论...
验证码 换一张
取 消