The following code somehow does not notice any files with non-ASCII characters in their names (for example, Cyrillic characters):
for (int path = 1; path < argc; path++) {
QFileInfo fi(argv[path]);
if (fi.isDir()) {
QDir dir(argv[path], "", QDir::LocaleAware, QDir::AllEntries);
qDebug() << dir.entryList();
QDirIterator it(QString(argv[path]), QDirIterator::Subdirectories);
while (it.hasNext()) {
it.next();
qDebug() << it.fileInfo().absoluteFilePath();
}
}
}
What exactly am I doing wrong here? How do I handle QDir and QDirIterator so that they know about Cyrillic file names?
The locale of the system en_US.UTF-8.
Update: On Windows, everything is working correctly.
source
share