diff --git a/0013-Fix-terminal-garbled-characters.patch b/0013-Fix-terminal-garbled-characters.patch new file mode 100644 index 0000000000000000000000000000000000000000..7e35bd47549053995abe338a7320398cbd9e3ebc --- /dev/null +++ b/0013-Fix-terminal-garbled-characters.patch @@ -0,0 +1,64 @@ +From 4e7530f9f86659af5b56cd01e8b0274dc089c4a4 Mon Sep 17 00:00:00 2001 +From: peijiankang +Date: Mon, 20 Mar 2023 18:53:40 +0800 +Subject: [PATCH] Fix terminal garbled characters + +--- + plugins/time-language/area/area.cpp | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +diff --git a/plugins/time-language/area/area.cpp b/plugins/time-language/area/area.cpp +index df6834d..1196406 100644 +--- a/plugins/time-language/area/area.cpp ++++ b/plugins/time-language/area/area.cpp +@@ -184,7 +184,7 @@ void Area::initLanguage() + + QStringList res = getUserDefaultLanguage(); + QString lang = res.at(1); +- int langIndex = lang.split(':').at(0) == "zh_CN" ? 0 : 1; ++ int langIndex = lang.split(':').at(0) == "zh_CN.UTF-8" ? 0 : 1; + + if (0 == langIndex) { + chineseFrame->showSelectedIcon(true); +@@ -201,13 +201,13 @@ void Area::initLanguage() + + connect(chineseFrame, &LanguageFrame::clicked, this, [=](){ + englishFrame->showSelectedIcon(false); +- m_areaInterface->call("SetLanguage","zh_CN"); ++ m_areaInterface->call("SetLanguage","zh_CN.UTF-8"); + showMessageBox(2); + }); + + connect(englishFrame, &LanguageFrame::clicked, this, [=](){ + chineseFrame->showSelectedIcon(false); +- m_areaInterface->call("SetLanguage","en_US"); ++ m_areaInterface->call("SetLanguage","en_US.UTF-8"); + showMessageBox(2); + }); + } +@@ -218,9 +218,9 @@ void Area::initComponent() { + + QStringList res = getUserDefaultLanguage(); + QString lang = res.at(1); +- int langIndex = lang.split(':').at(0) == "zh_CN" ? 1 : 0; ++ //int langIndex = lang.split(':').at(0) == "zh_CN" ? 1 : 0; + int formatIndex = res.at(0) == "zh_CN.UTF-8" ? 1 : 0; +- // ui->langcomboBox->setCurrentIndex(langIndex); ++ //ui->langcomboBox->setCurrentIndex(langIndex); + ui->countrycomboBox->setCurrentIndex(formatIndex); + + if (ui->countrycomboBox->currentIndex() == 1) { +@@ -348,6 +348,10 @@ QStringList Area::getUserDefaultLanguage() { + } else { + qDebug() << "reply failed"; + } ++ if(formats.isEmpty()) ++ formats = QLocale::system().name() + ".UTF-8"; ++ if(language.isEmpty()) ++ language = QLocale::system().name() + ".UTF-8"; + result.append(formats); + result.append(language); + return result; +-- +2.39.1 +