Ok, so I have a file. Inside it it has a word (better: a filename) which contains greek characters. This is the code to read the file with the greek word and to add this word to a label:
char home1 [ 60 ]="/home/alex/check.txt";
char line1 [ 300 ];
FILE *file1 = fopen ( home1, "r" );
fgets ( line1, sizeof line1, file1 );
fclose ( file1 ); //Now `line1` has the word with the greek characters
string name = string(line1);
name.erase(name.length()-1); //Sorting the `name` to delete "\n"
cout << name; // Check: Here `name` is outputed normally, as it should (with the greek characters, so it's OK till now.
QString image_name
= QString::fromStdString(name
).
toUtf8();
//Here must be the evil function that destroys the `name` ui->image_name->setText(image_name.toUtf8()); //Finally, after the previous function has 'destroyed' the greek letters of `name`, the malformed `name` is put to the lineEdit :(
char home1 [ 60 ]="/home/alex/check.txt";
char line1 [ 300 ];
FILE *file1 = fopen ( home1, "r" );
fgets ( line1, sizeof line1, file1 );
fclose ( file1 ); //Now `line1` has the word with the greek characters
string name = string(line1);
name.erase(name.length()-1); //Sorting the `name` to delete "\n"
cout << name; // Check: Here `name` is outputed normally, as it should (with the greek characters, so it's OK till now.
QString image_name = QString::fromStdString(name).toUtf8(); //Here must be the evil function that destroys the `name`
ui->image_name->setText(image_name.toUtf8()); //Finally, after the previous function has 'destroyed' the greek letters of `name`, the malformed `name` is put to the lineEdit :(
To copy to clipboard, switch view to plain text mode
Read the code's comments 
Thx in advance for any reply
Bookmarks