65 lines
3.3 KiB
Diff
65 lines
3.3 KiB
Diff
--- ./scribus/plugins/scriptplugin/cmdgetsetprop.cpp.orig 2023-09-28 09:13:21.384565229 -0400
|
|
+++ ./scribus/plugins/scriptplugin/cmdgetsetprop.cpp 2023-09-28 09:21:08.298879558 -0400
|
|
@@ -409,10 +409,10 @@
|
|
success = obj->setProperty(propertyName, QString::fromUtf8(PyBytes_AsString(objValue)));
|
|
else if (PyUnicode_Check(objValue))
|
|
{
|
|
- // Get a pointer to the internal buffer of the Py_Unicode object, which is UCS2 formatted
|
|
- const unsigned short * ucs2Data = (const unsigned short *) PyUnicode_AS_UNICODE(objValue);
|
|
- // and make a new QString from it (the string is copied)
|
|
- success = obj->setProperty(propertyName, QString::fromUtf16(ucs2Data));
|
|
+ // Get the data as a wchar_t array and copy to a QString
|
|
+ Py_ssize_t wcsize = 0;
|
|
+ const wchar_t * const wcdata = PyUnicode_AsWideCharString(objValue, &wcsize);
|
|
+ success = obj->setProperty(propertyName, QString::fromWCharArray(wcdata, wcsize));
|
|
}
|
|
else
|
|
matched = false;
|
|
@@ -429,10 +429,10 @@
|
|
}
|
|
else if (PyUnicode_Check(objValue))
|
|
{
|
|
- // Get a pointer to the internal buffer of the Py_Unicode object, which is UCS2 formatted
|
|
- const unsigned short * utf16Data = (const unsigned short *)PyUnicode_AS_UNICODE(objValue);
|
|
- // and make a new QString from it (the string is copied)
|
|
- success = obj->setProperty(propertyName, QString::fromUtf16(utf16Data).toLatin1());
|
|
+ // Get the data as a wchar_t array and copy to a QString
|
|
+ Py_ssize_t wcsize = 0;
|
|
+ const wchar_t * const wcdata = PyUnicode_AsWideCharString(objValue, &wcsize);
|
|
+ success = obj->setProperty(propertyName, QString::fromWCharArray(wcdata, wcsize));
|
|
}
|
|
else
|
|
matched = false;
|
|
--- ./scribus/plugins/scriptplugin_py2x/cmdgetsetprop.cpp.orig 2023-09-28 09:13:07.372484278 -0400
|
|
+++ ./scribus/plugins/scriptplugin_py2x/cmdgetsetprop.cpp 2023-09-28 09:22:02.366125450 -0400
|
|
@@ -406,10 +406,10 @@
|
|
success = obj->setProperty(propertyName, QString::fromUtf8(PyString_AsString(objValue)));
|
|
else if (PyUnicode_Check(objValue))
|
|
{
|
|
- // Get a pointer to the internal buffer of the Py_Unicode object, which is UCS2 formatted
|
|
- const unsigned short * ucs2Data = (const unsigned short *)PyUnicode_AS_UNICODE(objValue);
|
|
- // and make a new QString from it (the string is copied)
|
|
- success = obj->setProperty(propertyName, QString::fromUtf16(ucs2Data));
|
|
+ // Get the data as a wchar_t array and copy to a QString
|
|
+ Py_ssize_t wcsize = 0;
|
|
+ const wchar_t * const wcdata = PyUnicode_AsWideCharString(objValue, &wcsize);
|
|
+ success = obj->setProperty(propertyName, QString::fromWCharArray(wcdata, wcsize));
|
|
}
|
|
else
|
|
matched = false;
|
|
@@ -426,10 +426,10 @@
|
|
}
|
|
else if (PyUnicode_Check(objValue))
|
|
{
|
|
- // Get a pointer to the internal buffer of the Py_Unicode object, which is UCS2 formatted
|
|
- const unsigned short * utf16Data = (const unsigned short *)PyUnicode_AS_UNICODE(objValue);
|
|
- // and make a new QString from it (the string is copied)
|
|
- success = obj->setProperty(propertyName, QString::fromUtf16(utf16Data).toLatin1());
|
|
+ // Get the data as a wchar_t array and copy to a QString
|
|
+ Py_ssize_t wcsize = 0;
|
|
+ const wchar_t * const wcdata = PyUnicode_AsWideCharString(objValue, &wcsize);
|
|
+ success = obj->setProperty(propertyName, QString::fromWCharArray(wcdata, wcsize));
|
|
}
|
|
else
|
|
matched = false;
|