From e0cc8e5031453cd52a72aeb2aa69161abadeaefb Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 6 May 2020 08:47:45 +0200 Subject: Windows: Fix encoding in custom message handler The code snippet passing the message to the Python handler used QString::toLocal8Bit() to convert the message. This is wrong as Python always requires UTF-8. Fixes: PYSIDE-1293 Change-Id: I1f16dad970aaf0d776e748110fc2054269412047 Reviewed-by: Christian Tismer --- sources/pyside2/PySide2/glue/qtcore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp index 169b89cae..834383679 100644 --- a/sources/pyside2/PySide2/glue/qtcore.cpp +++ b/sources/pyside2/PySide2/glue/qtcore.cpp @@ -608,7 +608,7 @@ static void msgHandlerCallback(QtMsgType type, const QMessageLogContext &ctx, co Shiboken::AutoDecRef arglist(PyTuple_New(3)); PyTuple_SET_ITEM(arglist, 0, %CONVERTTOPYTHON[QtMsgType](type)); PyTuple_SET_ITEM(arglist, 1, %CONVERTTOPYTHON[QMessageLogContext &](ctx)); - QByteArray array = msg.toLocal8Bit(); + QByteArray array = msg.toUtf8(); // Python handler requires UTF-8 char *data = array.data(); PyTuple_SET_ITEM(arglist, 2, %CONVERTTOPYTHON[char *](data)); Shiboken::AutoDecRef ret(PyObject_CallObject(qtmsghandler, arglist)); -- cgit v1.2.3