activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <>
Subject RE: ActiveMQcpp cms::Session::createTextMessage() function usage question with ISO-8859-1 strings
Date Mon, 31 Aug 2009 22:41:57 GMT
On Mon, 2009-08-31 at 08:52 -0700, rainy3 wrote:
> Hello,
> I just need more clarification on this case. Assume that i have a ActiveMQ
> broker, java producer and c++ consumer for text messages. Producer read some
> text from database for example in ISO-8859-1 charset. Then it creates text
> message (conversion to UTF-8) and send it to broker. Then, finally, consumer
> won't be able to read this text messages because backward conversion (C++
> client) allows only ASCII chars, right?

When the String value in the TextMessage (Java Strings are in UTF-16) is
written on the wire its converted to a modified UTF-8 representation.
The C++ expects all the string values it reads from the Broker to be in
this representation, so it knows how to read and convert the UTF-8
values back to single byte char values.  The CMS API doesn't currently
have methods for dealing with multibyte C++ strings so strings are
expected to be encoded with values from 0-255.   For ISO-8859-1 that
should be ok since as I recall that defines values from 0-191 so your
strings should be read fine.

Of course the C++ string you get out is going to be composed of a char*
array which is a signed byte, but you can always cast it to an unsigned
char* and use the full range 0-255 as you please.

Does that help?


Tim Bish

View raw message