Merge pull request #490 from tiresiasfromthebai/fix-console-utf8

Decode console output as UTF-8 instead of Latin-1
This commit is contained in:
Ernie Pasveer
2026-07-24 07:09:24 -05:00
committed by GitHub
2 changed files with 11 additions and 1 deletions
+5 -1
View File
@@ -89,7 +89,11 @@ void SeerConsoleWidget::handleText (const char* buffer, int count) {
}
// Write text to Ansi widget.
QString str = QString::fromLatin1(buffer, count);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QString str = _utf8Decoder.decode(QByteArrayView(buffer, count));
#else
QString str = QString::fromUtf8(buffer, count);
#endif
textEdit->insertAnsiText(str);
textEdit->ensureCursorVisible();
+6
View File
@@ -10,6 +10,9 @@
#include <QtGui/QShowEvent>
#include <QtCore/QString>
#include <QtCore/QSocketNotifier>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <QtCore/QStringConverter>
#endif
#include "ui_SeerConsoleWidget.h"
class SeerConsoleWidget : public QWidget, protected Ui::SeerConsoleWidgetForm {
@@ -73,5 +76,8 @@ class SeerConsoleWidget : public QWidget, protected Ui::SeerConsoleWidgetForm {
QSocketNotifier* _ttyListener;
bool _enableStdout;
bool _enableWrap;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QStringDecoder _utf8Decoder{QStringConverter::Utf8}; // Keeps state across reads so multi-byte sequences split by the 1024-byte buffer decode correctly.
#endif
};