View Full Version : Qt Ubuntu encoding of Characters

26th January 2013, 18:10
Hello everyone,

I've got the problem that Qt has a problem when I want to open a file from the command line with (I'm using Ubuntu)

./myapp /home/username/Arbeitsfläche/somefile

the problem is that Arbeitsfläche is read as: Arbeitsfläche and if I want to open it, that directory doesn't exist

if I open the file with: QFileDialog::getOpenFileName, I get the correct string

can someone help me out or point me in the right direction?

thank you


26th January 2013, 20:22
the problem is that Arbeitsfläche is read as
Is read by whom? If you hardcoded the filename in your application, you need to tell Qt, what encoding you used (e.g. QString::fromUtf8()).

27th January 2013, 14:19
QString::fromUtf8() will most likely work since most Linux systems have been using that codec for years now.
Alternatively use QString::fromLocal8Bit() which uses the system's locale information to determine the currently used encoding

Also have a look at QFile::decodeName()


27th January 2013, 15:38
great, thanks to both of you, I used QString::fromLocal8Bit()