You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Håkan Johansson (JIRA)" <ji...@apache.org> on 2016/02/26 13:36:18 UTC
[jira] [Created] (QPID-7109) Python wrapper for qpid-cpp cannot
handle unicode data.
Håkan Johansson created QPID-7109:
-------------------------------------
Summary: Python wrapper for qpid-cpp cannot handle unicode data.
Key: QPID-7109
URL: https://issues.apache.org/jira/browse/QPID-7109
Project: Qpid
Issue Type: Bug
Components: Python Client (Wrapped)
Affects Versions: qpid-cpp-0.34
Environment: Red Hat Enterprise Linux Server release 6.7 (Santiago)
Reporter: Håkan Johansson
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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org