Skip to content

Commit

Permalink
fix: auto detect console page code
Browse files Browse the repository at this point in the history
  • Loading branch information
Mythologyli committed Jul 20, 2024
1 parent 24b5329 commit 07520b3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);;
Expand Down

0 comments on commit 07520b3

Please sign in to comment.