diff options
| author | Gordon Sim <gsim@apache.org> | 2013-09-05 20:38:15 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2013-09-05 20:38:15 +0000 |
| commit | ed10c297f0b6e8232e0f2cbc0e88cc7d473982a1 (patch) | |
| tree | 14dd6bd29dc5b4a15958bfd8c5505ff68e8ffaaa /cpp/include | |
| parent | d729a4befc08ee8fbd891dcaa94c6e86d385da16 (diff) | |
| download | qpid-python-ed10c297f0b6e8232e0f2cbc0e88cc7d473982a1.tar.gz | |
QPID-5104: make handling of properties in swigged impl match the pure python impl more closely
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1520416 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/include')
| -rw-r--r-- | cpp/include/qpid/messaging/Message.h | 1 | ||||
| -rw-r--r-- | cpp/include/qpid/swig_python_typemaps.i | 10 |
2 files changed, 10 insertions, 1 deletions
diff --git a/cpp/include/qpid/messaging/Message.h b/cpp/include/qpid/messaging/Message.h index 10569eb006..6315d3e86f 100644 --- a/cpp/include/qpid/messaging/Message.h +++ b/cpp/include/qpid/messaging/Message.h @@ -149,6 +149,7 @@ class QPID_MESSAGING_CLASS_EXTERN Message */ QPID_MESSAGING_EXTERN const qpid::types::Variant::Map& getProperties() const; QPID_MESSAGING_EXTERN qpid::types::Variant::Map& getProperties(); + QPID_MESSAGING_EXTERN void setProperties(const qpid::types::Variant::Map&); /** * Set the content to the data held in the string parameter. Note: diff --git a/cpp/include/qpid/swig_python_typemaps.i b/cpp/include/qpid/swig_python_typemaps.i index 25a4e46b18..ef32012693 100644 --- a/cpp/include/qpid/swig_python_typemaps.i +++ b/cpp/include/qpid/swig_python_typemaps.i @@ -61,6 +61,11 @@ typedef int Py_ssize_t; if (PyInt_Check(value)) return qpid::types::Variant(int64_t(PyInt_AS_LONG(value))); if (PyLong_Check(value)) return qpid::types::Variant(int64_t(PyLong_AsLongLong(value))); if (PyString_Check(value)) return qpid::types::Variant(std::string(PyString_AS_STRING(value))); + if (PyUnicode_Check(value)) { + qpid::types::Variant v(std::string(PyUnicode_AS_DATA(value))); + v.setEncoding("utf8"); + return v; + } if (PyDict_Check(value)) { qpid::types::Variant::Map map; PyToMap(value, &map); @@ -116,7 +121,10 @@ typedef int Py_ssize_t; } case qpid::types::VAR_STRING : { const std::string val(v->asString()); - result = PyString_FromStringAndSize(val.c_str(), val.size()); + if (v->getEncoding() == "utf8") + result = PyUnicode_FromStringAndSize(val.c_str(), val.size()); + else + result = PyString_FromStringAndSize(val.c_str(), val.size()); break; } case qpid::types::VAR_MAP : { |
