Commit 7cbb628e authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Ensure we always use UTF-8 enconding when writing files

parent f0bba703
......@@ -1570,6 +1570,7 @@ void Bin::slotReloadClip()
KMessageBox::sorry(this, i18n("Unable to write to file %1", path));
} else {
QTextStream out(&f);
out.setCodec("UTF-8");
out << doc.toString();
f.close();
KMessageBox::information(
......@@ -1873,6 +1874,7 @@ void Bin::createClip(const QDomElement &xml)
KMessageBox::sorry(this, i18n("Unable to write to file %1", path));
} else {
QTextStream out(&f);
out.setCodec("UTF-8");
out << doc.toString();
f.close();
KMessageBox::information(
......
......@@ -749,6 +749,7 @@ bool RenderWidget::saveProfile(QDomElement newprofile)
return false;
}
QTextStream out(&file);
out.setCodec("UTF-8");
out << doc.toString();
if (file.error() != QFile::NoError) {
KMessageBox::error(this, i18n("Cannot write to file %1", dir.absoluteFilePath("customprofiles.xml")));
......@@ -984,6 +985,7 @@ void RenderWidget::slotEditProfile()
return;
}
QTextStream out(&file);
out.setCodec("UTF-8");
out << doc.toString();
if (file.error() != QFile::NoError) {
KMessageBox::error(this, i18n("Cannot write to file %1", exportFile));
......@@ -1040,6 +1042,7 @@ void RenderWidget::slotDeleteProfile(bool dontRefresh)
return;
}
QTextStream out(&file);
out.setCodec("UTF-8");
out << doc.toString();
if (file.error() != QFile::NoError) {
KMessageBox::error(this, i18n("Cannot write to file %1", exportFile));
......@@ -2297,6 +2300,7 @@ void RenderWidget::parseFile(const QString &exportFile, bool editable)
return;
}
QTextStream out(&file);
out.setCodec("UTF-8");
out << newdoc.toString();
file.close();
parseFile(exportFile, editable);
......@@ -2946,6 +2950,7 @@ bool RenderWidget::startWaitingRenderJobs()
}
QTextStream outStream(&file);
outStream.setCodec("UTF-8");
#ifndef Q_OS_WIN
outStream << "#!/bin/sh\n\n";
#endif
......
......@@ -1827,6 +1827,7 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
if (file.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&file);
out.setCodec("UTF-8");
out << doc.toString();
}
file.close();
......
......@@ -941,6 +941,7 @@ void KdenliveDoc::saveCustomEffects(const QDomNodeList &customeffects)
QFile file(path);
if (file.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&file);
out.setCodec("UTF-8");
out << doc.toString();
}
}
......
......@@ -259,6 +259,7 @@ void EffectTreeModel::editCustomAsset(const QString newName,const QString newDes
if (file.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&file);
out.setCodec("UTF-8");
out << doc.toString();
}
file.close();
......@@ -272,6 +273,7 @@ void EffectTreeModel::editCustomAsset(const QString newName,const QString newDes
QFile file(dir.absoluteFilePath(currentName + QStringLiteral(".xml")));
if (file.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&file);
out.setCodec("UTF-8");
out << doc.toString();
}
file.close();
......
......@@ -385,6 +385,7 @@ QPair <QString, QString> EffectsRepository::fixCustomAssetFile(const QString &pa
}
if (file.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&file);
out.setCodec("UTF-8");
out << doc.toString();
}
file.close();
......
......@@ -561,6 +561,7 @@ void CollapsibleEffectView::slotSaveEffect()
if (file.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&file);
out.setCodec("UTF-8");
out << doc.toString();
}
file.close();
......
......@@ -507,6 +507,7 @@ void EffectStackView::slotSaveStack()
QFile file(dir.absoluteFilePath(name + QStringLiteral(".xml")));
if (file.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&file);
out.setCodec("UTF-8");
out << doc.toString();
}
file.close();
......
......@@ -103,6 +103,7 @@ void ProxyTask::run()
if (playlist->open()) {
source = playlist->fileName();
QTextStream out(playlist);
out.setCodec("UTF-8");
out << doc.toString();
playlist->close();
}
......
......@@ -1166,6 +1166,7 @@ void ProjectManager::saveWithUpdatedProfile(const QString &updatedProfile)
return;
}
QTextStream out(&file);
out.setCodec("UTF-8");
out << doc.toString();
if (file.error() != QFile::NoError) {
KMessageBox::error(qApp->activeWindow(), i18n("Cannot write to file %1", convertedFile));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment