Hi
I've written the following code
filename
= QFileDialog::getSaveFileName(this,
"Choose where to save",
"",
"*.jobs");
if (!filename.isEmpty()){
if (file.
open(QFile::WriteOnly)){ out.setCodec("ISO 8859-1");
out << ui->teScript->toPlainText();
file.close();
}
else
}
QString filename;
filename = QFileDialog::getSaveFileName(this,"Choose where to save","","*.jobs");
if (!filename.isEmpty()){
QFile file(filename);
if (file.open(QFile::WriteOnly)){
QTextStream out(&file);
out.setCodec("ISO 8859-1");
out << ui->teScript->toPlainText();
file.close();
}
else
QMessageBox::critical(this,"Error opening file",filename + "\ncould not be opened",QMessageBox::Ok);
}
To copy to clipboard, switch view to plain text mode
Where teScript is a QTextEdit. So If I write something like (on the text edit, when executing the program):
Hello
my name is
John
Smith
and then I open the generated txt file (with notepad) i get every line concatenated with a strange square character in the middle.
So I was wondering how I could possibly fix this problem?
PS: The problem is in Windows.
Bookmarks