Hi,
my program has to work on Windows and Android.
When I want to display files in a folder, I have encoding problems, as Android apparently uses utf8 for its file system. This is what I do:

Qt Code:
  1. ui->label->setText("Hallo Ä Ö Ü ä ö ü ß .,;*+");
  2. QStringList files=dir.entryList(QStringList()<<"*.*");
  3. for (int i= 0;i<files.count();i++)
  4. {
  5. QTreeWidgetItem* item=new QTreeWidgetItem(QStringList()<<files.at(i));
  6. ui->treeWidget->addTopLevelItem(item);
  7. }
To copy to clipboard, switch view to plain text mode 
The label->setText stuff is shown correctly, so this is not a display thing. The treeWidget looks like this
android.jpg (Android)
instead of this
windows.jpg (Windows).
So the umlauts are borked.

I've tried setting the default locale to german and english, but this didn't help:
Qt Code:
  1. QLocale germanLocale(QLocale::German,QLocale::Germany) ;
  2. QLocale englishLocale(QLocale::English, QLocale::UnitedStates);
  3. QLocale::setDefault(germanLocale);
  4. // QLocale::setDefault(englishLocale);
To copy to clipboard, switch view to plain text mode 

Furthermore I've tried getting the entryInfoList, then decoding the fileName. But since QFileInfo::fileName() returns a String, I feel like chasing my own tail here:
Qt Code:
  1. QFileInfoList infos=dir.entryInfoList(QStringList()<<"*.*");
  2. for (int i=0; i<infos.count();i++)
  3. {
  4. QFileInfo inf=infos.at(i);
  5. QString fileName= QFile::decodeName(inf.fileName().toUtf8());
  6. ui->treeWidget->addTopLevelItem(item);
  7. }
To copy to clipboard, switch view to plain text mode 
Needless to say that it also didn't work.


I'm at my (small) wit's end.