ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General IBM MQ Support » Problem reading message from queue in .NET

Post new topic  Reply to topic
 Problem reading message from queue in .NET « View previous topic :: View next topic » 
Author Message
Frik
PostPosted: Sun Jun 02, 2013 5:08 am    Post subject: Problem reading message from queue in .NET Reply with quote

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
View user's profile Send private message
zpat
PostPosted: Sun Jun 02, 2013 8:16 am    Post subject: Reply with quote

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
View user's profile Send private message
Frik
PostPosted: Sun Jun 02, 2013 8:22 am    Post subject: Reply with quote

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
View user's profile Send private message
rekarm01
PostPosted: Wed Jun 05, 2013 2:01 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » Problem reading message from queue in .NET
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.