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

Ensure we always use UTF-8 enconding when writing files

parent 85dfe0a0
......@@ -1556,6 +1556,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(
......@@ -1859,6 +1860,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(
......
......@@ -735,6 +735,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")));
......@@ -954,6 +955,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));
......@@ -1010,6 +1012,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));
......@@ -2268,6 +2271,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);
......@@ -2917,6 +2921,7 @@ bool RenderWidget::startWaitingRenderJobs()
}
QTextStream outStream(&file);
outStream.setCodec("UTF-8");
#ifndef Q_OS_WIN
outStream << "#!/bin/sh\n\n";
#endif
......
......@@ -1814,6 +1814,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();
......
......@@ -928,6 +928,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();
}
}
......
......@@ -243,6 +243,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();
......@@ -256,6 +257,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();
......
......@@ -369,6 +369,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();
......
......@@ -551,6 +551,7 @@ void CollapsibleEffectView::slotSaveEffect()
if (file.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&file);
out.setCodec("UTF-8");
out << doc.toString();
}
file.close();
......
......@@ -497,6 +497,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();
......
......@@ -89,6 +89,7 @@ void ProxyTask::run()
if (playlist->open()) {
source = playlist->fileName();
QTextStream out(playlist);
out.setCodec("UTF-8");
out << doc.toString();
playlist->close();
}
......
......@@ -1173,6 +1173,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