Author |
Message
|
xmqymshr |
Posted: Thu Jul 14, 2016 12:33 pm Post subject: How to get message wehn it has multi language in xml |
|
|
Novice
Joined: 13 Jan 2016 Posts: 14
|
I am try to get an xml message with multi language values.So after executing the queue.Get the language is converted into ????????? . Below is my code. I tried to use character set 1208 which is utf8
Code: |
queueMessage = new MQMessage { Format = MQC.MQFMT_STRING };
queueMessage.CharacterSet = 1208;
queue.Get(queueMessage); |
|
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Jul 14, 2016 10:23 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
a few things to consider/do.
1) browse the message and see what CCSID it was written in.
2) Verify using a utility such as amqsbcg that the HEX values in the message actually match the right characters in the Character Set Map for the CCSID that the message was sent using.
It might be that the sender put the message onto the queue with the data in one CCSID but set the message properties to indicate that it is actually a different CCSID.
3) the ?????? might be that the application you are using to view the data can't map it properly. 2) above can help you verify that.
4) Setting a CCSID on a GET Operation actually does nothing. MQ is designed to read the message and pass it to your app using the data in the message. IF the CCSID in the message does not match the data then you will get garbage.
Go back to the message that you are trying to read and make sure that it is 10000000% correctly written. IF it isn't then go back to the people who wrote it and get them to fix the problem. If for some reason they won't then you won't be able to read it correctly.
5) Finally, this (2) above) is not an uncommon thing. It can take some time to get your head around CCSID's and what they are all about. some of us have been working with them for years and years and it becomes second nature to us. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Jul 15, 2016 3:59 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
|
Back to top |
|
 |
tczielke |
Posted: Fri Jul 15, 2016 4:10 am Post subject: |
|
|
Guardian
Joined: 08 Jul 2010 Posts: 941 Location: Illinois, USA
|
One other note. The MH06 supportpac has functionality in the mqtrcfrmt program called message parsing that will analyze a message as if it was 1208 (UTF8) or 1200 (UTF16) and then provide information on if any of the bytes of the message would be invalid for that assumed code page, are multi-byte, are surrogate pairs, and the offsets of where these identified bytes are located in the message. This can be helpful in investigating if a message was incorrectly labeled for certain CCSIDs. You can help validate either if a message was incorrectly labeled as 1208 or 1200, or if a 1200/1208 message was incorrectly labeled as another CCSID with this tool. _________________ Working with MQ since 2010. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Jul 15, 2016 5:36 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
smdavies99 wrote: |
4) Setting a CCSID on a GET Operation actually does nothing. MQ is designed to read the message and pass it to your app using the data in the message. IF the CCSID in the message does not match the data then you will get garbage.
Go back to the message that you are trying to read and make sure that it is 10000000% correctly written. IF it isn't then go back to the people who wrote it and get them to fix the problem. If for some reason they won't then you won't be able to read it correctly.
|
And here I thought that setting the CCSID on the message before the get operation, in conjunction with the convert flag, asked the queue manager to deliver the message in the requested CCSID if the format was MQFMT_STRING.
Of course this can only make sense if the message was created with the CCSID corresponding to the data it carries.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
smdavies99 |
Posted: Fri Jul 15, 2016 11:28 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
fjb_saper wrote: |
And here I thought that setting the CCSID on the message before the get operation, in conjunction with the convert flag, asked the queue manager to deliver the message in the requested CCSID if the format was MQFMT_STRING.
Of course this can only make sense if the message was created with the CCSID corresponding to the data it carries.  |
You are right but in the sample supplied, there was no setting of the convert option.
Setting the convert option is IMHO the last option. IT can cause more problems than it solves but until we know more about the message then I would not want to get the OP going down route. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
xmqymshr |
Posted: Fri Jul 15, 2016 11:49 am Post subject: |
|
|
Novice
Joined: 13 Jan 2016 Posts: 14
|
Thank you every one for taking a look. The problem was on the sender side the fixed the encoding to utf8 and then everything is running fine now. i did not had to change any thing on the receiver side |
|
Back to top |
|
 |
|