|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
JMS incoming Text Message and charset conversion |
« View previous topic :: View next topic » |
Author |
Message
|
rsinha |
Posted: Wed May 12, 2004 9:36 am Post subject: JMS incoming Text Message and charset conversion |
|
|
Apprentice
Joined: 29 Aug 2003 Posts: 42
|
Hi, According to the JMS doc -
TextMessage
is an encoded string. For an outgoing message, the string is encoded in the character set given by the destination object. This defaults to UTF8 encoding (the UTF8 encoding starts with the first character of the message; there is no length field at the start). It is, however, possible to specify any other character set supported by WebSphere MQ Java. Such character sets are used mainly when you send a message to a non-JMS application.
If the character set is a double-byte set (including UTF16), the destination object's integer encoding specification determines the order of the bytes.
[size=18]An incoming message is interpreted using the character set and encoding that are specified in the message itself. These specifications are in the last WebSphere MQ header (or MQMD if there are no headers). For JMS messages, the last header is usually the MQRFH2. [/size]
I, however tried sending a Text Message using utf-8 encoding. At the oter end, first I read it using another JMS application, which gave me certain total byte count. Then, before reading the incoming message, I set setCCSID(int x) on Destination object to iso-8859-1. I was under the impression that I wouldn't see any change in behaviour this time as JMS will still interpret the message as utf-8, which is what the message was sent as by sending application.
But, after setting the ccsid to iso-8859-1 and then reading the message, when I took the total byte count, it was different then when I wasn't setting the ccsid to anything in the receiving application.
Can someone explain what's going on?
Thanx |
|
Back to top |
|
 |
mqonnet |
Posted: Wed May 12, 2004 1:23 pm Post subject: |
|
|
 Grand Master
Joined: 18 Feb 2002 Posts: 1114 Location: Boston, Ma, Usa.
|
I havent played much with JMS but this is my take.
"But, after setting the ccsid to iso-8859-1 and then reading the message, when I took the total byte count, it was different then when I wasn't setting the ccsid to anything in the receiving application"
---From the manuals.
"If the MQGMO_CONVERT option is specified on the MQGET call, this field is an input/output field. The value specified by the application is the coded character-set identifier to which the message data should be converted if necessary. If conversion is successful or unnecessary, the value is unchanged (except that the value MQCCSI_Q_MGR or MQCCSI_INHERIT is converted to the actual value). If conversion is unsuccessful, the value after the MQGET call represents the coded character-set identifier of the unconverted message that is returned to the application.
"
If you are doing a get and you are setting the ccisd, then a conversion takes place(if necessary) to the requesting ccsid from the one the original message was put with. This is probably what you are noticing.
Cheers
Kumar _________________ IBM Certified WebSphere MQ V5.3 Developer
IBM Certified WebSphere MQ V5.3 Solution Designer
IBM Certified WebSphere MQ V5.3 System Administrator |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|