|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Problem reading message from queue in .NET |
« View previous topic :: View next topic » |
Author |
Message
|
Frik |
Posted: Sun Jun 02, 2013 5:08 am Post subject: Problem reading message from queue in .NET |
|
|
Acolyte
Joined: 25 Nov 2009 Posts: 69
|
Hello all,
I'm trying to read messages from queue using .net.
Unfortunately, some of the characters, which sent to me with UTF8 in Hebrew - are incorrect and messed (gibrish).
I'm checking the Charset in my code and it's seem to be 862, instead of 1208 or 912 as the QM defined.
This is my code, what's wrong?
Quote: |
mqQueueRsp = mqQMgr.AccessQueue(returnQueue, MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING);
mqGetMsgOpts.WaitInterval = 10000;
mqGetMsgOpts.Options = MQC.MQGMO_CONVERT | MQC.MQGMO_WAIT | MQC.MQGMO_FAIL_IF_QUIESCING;
mqQueueRsp.Get(mqMsgRsp, mqGetMsgOpts);
mqXMLResponse = mqMsgRsp.ReadString (mqMsgRsp.MessageLength); |
I would appreciate any help.
Thanks. |
|
Back to top |
|
 |
zpat |
Posted: Sun Jun 02, 2013 8:16 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Set the MQMD.CCSID to what you want it converted to.
Otherwise it will take the platform CCSID which is the client platform (not the QM) if using MQ client connections. |
|
Back to top |
|
 |
Frik |
Posted: Sun Jun 02, 2013 8:22 am Post subject: |
|
|
Acolyte
Joined: 25 Nov 2009 Posts: 69
|
zpat wrote: |
Set the MQMD.CCSID to what you want it converted to.
Otherwise it will take the platform CCSID which is the client platform (not the QM) if using MQ client connections. |
thought of it already,
but doesn't know how to do it with the .net way... |
|
Back to top |
|
 |
rekarm01 |
Posted: Wed Jun 05, 2013 2:01 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
Frik wrote: |
thought of it already,
but doesn't know how to do it with the .net way... |
ReadString() already converts from bytes to String, so specifying MQC.MQGMO_CONVERT isn't necessary. Without the convert option, setting the MQMD.CCSID (or, in this case, mqMsgRsp.CharacterSet) before the Get isn't necessary either.
The length argument for ReadString(length) specifies the number of characters to read from the message; MQMessage.MessageLength specifies the number of bytes in the message. That can get a bit tricky for UTF-8. |
|
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
|
|
|
|