diff options
author | Simon Rettberg | 2023-02-17 12:08:20 +0100 |
---|---|---|
committer | Simon Rettberg | 2023-02-17 12:08:20 +0100 |
commit | fd9ae49b5167bef653bdb96f638d0fdfed0553d6 (patch) | |
tree | 581d4741310d22bf34d5a799dc14939ac25261de | |
parent | cmake: Update a bit (diff) | |
download | printergui-fd9ae49b5167bef653bdb96f638d0fdfed0553d6.tar.gz printergui-fd9ae49b5167bef653bdb96f638d0fdfed0553d6.tar.xz printergui-fd9ae49b5167bef653bdb96f638d0fdfed0553d6.zip |
[maingui] Fallback to latin1 for document name encoding
-rw-r--r-- | src/maingui/printergui.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/maingui/printergui.cpp b/src/maingui/printergui.cpp index 3c6b224..a54ac7a 100644 --- a/src/maingui/printergui.cpp +++ b/src/maingui/printergui.cpp @@ -174,7 +174,12 @@ void PrinterGui::initializeUI() if (docName == NULL) { docName = "Untitled"; } - this->setWindowTitle(QString::fromUtf8("Drucken - %1 [%2]").arg(this->user, QString::fromUtf8(docName))); + QString docNameString = QString::fromUtf8(docName); + if (strcmp(docNameString.toUtf8().constData(), docName) != 0) { + // Not UTF-8, fallback to latin-1 + docNameString = QString::fromLatin1(docName); + } + this->setWindowTitle(QString::fromUtf8("Drucken - %1 [%2]").arg(this->user, docNameString)); this->show(); this->showNormal(); |