Hi Olivier,

The 'b' prefix in this case is part of the automatic character encoding of
the language in use, indicating that the string is a "bytes" object rather
than a Unicode string which is the default expectation of the C++. Have a
browse of the relevant character encoding documentation for the language in
question, for instance
https://www.pythoncentral.io/python-unicode-encode-decode-strings-python-2x/
for python. For the simple case of a string literal you could try assigning
your string with Message(u"[MESSAGE]").

Hope that helps

Chris



On 21 December 2017 at 16:51, Olivier Delbeke <olivier.delb...@awtce.be>
wrote:

>  Hi all,
>
> When I send messages to a queue using the java or python APIs, the message
> body I receive on the other side (C++ binding) is preceded by b" and
> appended with ".
> When I send the same message with the C++ API, I do not have this
> behaviour.
>
> Example:
> [C++] sender.send( proton::message("[MESSAGE]") )
> --> results in [MESSAGE] in C++ ( to_string(message.body()) )
>
> [python] sender.send( Message(body="[MESSAGE]") )
> --> results in b"[MESSAGE]" in C++ ( to_string(message.body()) ) => b and
> " are added at the beginning, and " is added at the end.
>
> I tried many things like forcing the "content_type" and the
> "content_encoding", or changing the "inferred" flag, but nothing helped.
> These annoying b" and " are still there.
> Looking at the source code of qpid proton, I also do not find where they
> could be added or why.
>
> (BTW, I use qpid-proton 0.18.0)
>
> Any idea ?
>
> Olivier
>
>


-- 

*Chris Richardson*, System Architect
c...@fourc.eu


*FourC AS, Vestre Rosten 81, Trekanten, NO-7075 Tiller, Norwaywww.fourc.eu
<http://www.fourc.eu/>*

*Follow us on LinkedIn <http://bit.ly/fourcli>, Facebook
<http://bit.ly/fourcfb>, Google+ <http://bit.ly/fourcgp> and Twitter
<http://bit.ly/fourctw>!*

Reply via email to