From 324715db9d9ec8518456abbcf7a41adc0709f462 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Sat, 7 Dec 2013 15:35:55 -0800 Subject: [PATCH] Pass message as a unicode object, to avoid encoings getting screwed up --- Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp b/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp index e1bcceac..69fde6cb 100644 --- a/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp @@ -2162,11 +2162,13 @@ bool plPythonFileMod::MsgReceive(plMessage* msg) } plProfile_BeginTiming(PythonUpdate); + plStringBuffer wMessage = pkimsg->GetString().ToWchar(); + PyObject* uMessage = PyUnicode_FromWideChar(wMessage, wMessage.GetSize()); PyObject* retVal = PyObject_CallMethod( fPyFunctionInstances[kfunc_RTChat], (char*)fFunctionNames[kfunc_RTChat], - "Osl", player, pkimsg->GetString().c_str(), - pkimsg->GetFlags()); + "OOl", player, uMessage, pkimsg->GetFlags()); + Py_DECREF(uMessage); if ( retVal == nil ) { #ifndef PLASMA_EXTERNAL_RELEASE