Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
qpid-cpp-0.34
-
None
-
None
-
Red Hat Enterprise Linux Server release 6.7 (Santiago)
Description
The Python wrapper for the qpid-cpp library cannot handle unicode data properly. The reason for this is how unicode objects are encoded in the PyToVariant function, which is located in the "swig_python_typemaps.i" file.
PyToVariant uses the PyUnicode_AS_DATA to encode the data, but that is wrong. It returns the internal representation of the data, which usually is UTF-16, but that depends on how the Python libraries where built. The VariantToPy function correctly uses the PyUnicode_DecodeUTF8 function, but that is not compatible with the data returned from PyUnicode_AS_DATA.
The proper solution is to either use PyUnicode_EncodeUTF8 or PyUnicode_AsUTF8String, including proper error handling.