aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-05-06 08:47:45 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-05-06 13:57:05 +0200
commite0cc8e5031453cd52a72aeb2aa69161abadeaefb (patch)
tree5d431d4a664d3de8817d49461857028110ee169f
parentd69e8968542ff92abb261918dc20ed8da0e38990 (diff)
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 <tismer@stackless.com>
-rw-r--r--sources/pyside2/PySide2/glue/qtcore.cpp2
1 files changed, 1 insertions, 1 deletions
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));