From 07520b3b56fe3a11fa75d6ffcd89f9610fbde9c5 Mon Sep 17 00:00:00 2001 From: Myth Date: Sun, 21 Jul 2024 00:01:42 +0800 Subject: [PATCH] fix: auto detect console page code --- utils/utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/utils.cpp b/utils/utils.cpp index 5e8d214..07881f7 100644 --- a/utils/utils.cpp +++ b/utils/utils.cpp @@ -35,12 +35,12 @@ QString Utils::ConsoleOutputToQString(const QByteArray &byteArray) QString gbkStr = gbkCodec->toUnicode(byteArray); QByteArray gbkByteArrayBack = gbkCodec->fromUnicode(gbkStr); - if (utf8ByteArrayBack == byteArray || gbkByteArrayBack != byteArray) + if (utf8ByteArrayBack == byteArray && gbkByteArrayBack != byteArray) { codeName = "UTF-8"; return utf8Str; } - else if (gbkByteArrayBack == byteArray || utf8ByteArrayBack != byteArray) + else if (gbkByteArrayBack == byteArray && utf8ByteArrayBack != byteArray) { codeName = "GBK"; return QTextCodec::codecForName("GBK")->toUnicode(byteArray);;