Author |
Message
|
neeha_kashyap120 |
Posted: Tue Mar 30, 2010 6:52 am Post subject: UTF -16 support |
|
|
 Apprentice
Joined: 05 Mar 2009 Posts: 31
|
Hi
Does WMB 6.1 support UTF-16. We are sending a XML message which is encoded in UTF -8(CCSID 819) and the target application wants it in UTF-16. Is there a way we can do the conversion in WMB. I tried the following but did not work
RCD Node(converting XML to BLOB) ---> Compute(with the following code) ---> MQoutput.
Code: |
SET OutputRoot.BLOB.BLOB = CAST((InputRoot.BLOB.BLOB) AS BLOB CCSID 1200);
|
Thanks
Neeha _________________ Neeharika Kashyap
IBM Certified System Administrator - WebSphere MQ V6.0
Trying to be IBM Certified System Administrator - WebSphere Message Broker V6.1 and IBM Certified Solution Developer - WebSphere Message Broker V6.1 |
|
Back to top |
|
 |
mqsiuser |
Posted: Tue Mar 30, 2010 7:05 am Post subject: UTF8 --> UTF16 |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
Hello,
you need to set some header fields to the new CCS-Id (Properties or MQMD):
Properties.Encoding = ...
Properties.CodedCharSetId = ...
MQMD.CodedCharSetId = ...
I don't think you need the code you state at all. I think message Broker uses UTF-16 for it's internal 'logical' representation, so basically you are already there. Just state in the headers, that you want the parser (which writes the message out) shall also use UTF-16. _________________ Just use REFERENCEs
Last edited by mqsiuser on Fri Jan 27, 2012 5:24 am; edited 2 times in total |
|
Back to top |
|
 |
zpat |
Posted: Tue Mar 30, 2010 7:13 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Try using a MQHeader node, leave out RCD and Compute.
However this is a bad MQ design.
Using a MQGET with CONVERT, the receiving application should not care what code page the message is in.
WMQ is cross-platform if used correctly. |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Mar 30, 2010 7:39 am Post subject: Re: UTF -16 support |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
neeha_kashyap120 wrote: |
Hi
Does WMB 6.1 support UTF-16. We are sending a XML message which is encoded in UTF -8(CCSID 819) and the target application wants it in UTF-16. Is there a way we can do the conversion in WMB. I tried the following but did not work
RCD Node(converting XML to BLOB) ---> Compute(with the following code) ---> MQoutput.
Code: |
SET OutputRoot.BLOB.BLOB = CAST((InputRoot.BLOB.BLOB) AS BLOB CCSID 1200);
|
Thanks
Neeha |
This is wrong in oh so many ways....
If the message sent is in UTF-8 its CCSID should be 1208 and not 819.
CCSID 819 is default char set for Unix. (ISO !!89-1 ?).
So
- first you need to make sure that the CCSID on the incoming message is correct.
- You do not specify what the content of your BLOB is. Assuming that it is all XML you could have it parsed in the XMLNSC domain.
- Do not set get with convert on the MQInput node. The broker will take care of any needed conversion
- On OutputRoot.Properties.CodedCharSetId set the value to 1200 (UTF-16)
- Last but not least if you only want to deal with the BLOB domain and your message content is all text you will need 2 casts:
from BLOB to CHARACTER with appropriate CCSID
from CHARACTER to BLOB with appropriate CCSID
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kimbert |
Posted: Tue Mar 30, 2010 7:41 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Does WMB 6.1 support UTF-16 |
Er,
Message broker supports just about any code page you would like to mention, and probably quite a few more besides.
Quote: |
We are sending a XML message which is encoded in UTF -8(CCSID 819) and the target application wants it in UTF-16. |
So your message flow has a defect. It should tell the XML parser to write the message in UTF-16 instead of UTF-8.
Quote: |
Is there a way we can do the conversion in WMB. I tried the following but did not work
RCD Node(converting XML to BLOB) ---> Compute(with the following code) ---> MQoutput.
|
Nope - that's definitely not the way to do it
You need to set OutputRoot.Properties.CodedCharSetId to 1200.
And you need to learn how the product works - otherwise your message flows are going to break a lot. |
|
Back to top |
|
 |
neeha_kashyap120 |
Posted: Tue Mar 30, 2010 8:51 am Post subject: |
|
|
 Apprentice
Joined: 05 Mar 2009 Posts: 31
|
Thanks for all your help. I was able to convert it to UTF-16 , but there is a wierd character in front of the output message
Code: |
ÿþ<?xml version="1.0" encoding="utf-16"?>
|
How can I fix that.
Thanks
Neeha _________________ Neeharika Kashyap
IBM Certified System Administrator - WebSphere MQ V6.0
Trying to be IBM Certified System Administrator - WebSphere Message Broker V6.1 and IBM Certified Solution Developer - WebSphere Message Broker V6.1 |
|
Back to top |
|
 |
zpat |
Posted: Tue Mar 30, 2010 9:24 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
There is no need to use WMB at all to send a WMQ message from one application to another and have it in a desired codepage on the MQGET.
Those extra characters might be BOM (Byte Order Mark). |
|
Back to top |
|
 |
neeha_kashyap120 |
Posted: Tue Mar 30, 2010 10:23 am Post subject: |
|
|
 Apprentice
Joined: 05 Mar 2009 Posts: 31
|
Hi
I am using WMB because I am also doing some mapping along with UTF -8 to UTF -16 conversion.
Is there a way to remove the Byte order mark or not to get them while making the conversion?
Thanks
Neeha _________________ Neeharika Kashyap
IBM Certified System Administrator - WebSphere MQ V6.0
Trying to be IBM Certified System Administrator - WebSphere Message Broker V6.1 and IBM Certified Solution Developer - WebSphere Message Broker V6.1 |
|
Back to top |
|
 |
kimbert |
Posted: Tue Mar 30, 2010 1:54 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Is there a way to remove the Byte order mark or not to get them while making the conversion? |
Any XML processor should tolerate a BOM, so it should not be necessary to remove it.
However, if you really need to, I suggest you try the following:
a) set OutputRoot.Properties.CodedCharSetId to 1201 or 1202. These encodings are byte-order specific, so the BOM should not be required.
b) if a) doesn't work, use ASBITSTREAM to turn OutputRoot.XMLNSC into a BLOB, and then detect and remove the BOM using SUBSTRING. |
|
Back to top |
|
 |
neeha_kashyap120 |
Posted: Wed Mar 31, 2010 8:35 am Post subject: |
|
|
 Apprentice
Joined: 05 Mar 2009 Posts: 31
|
Thanks for all your help guys.
I was able to fix the issue.
Neeha _________________ Neeharika Kashyap
IBM Certified System Administrator - WebSphere MQ V6.0
Trying to be IBM Certified System Administrator - WebSphere Message Broker V6.1 and IBM Certified Solution Developer - WebSphere Message Broker V6.1 |
|
Back to top |
|
 |
Vitor |
Posted: Wed Mar 31, 2010 9:33 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
neeha_kashyap120 wrote: |
I was able to fix the issue.
|
Care to share how for the benefit of future readers? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fszostak |
Posted: Mon Feb 21, 2011 10:41 am Post subject: |
|
|
Acolyte
Joined: 09 Feb 2011 Posts: 64 Location: Curitiba, Brazil
|
I have same problem.... how to fix?? how to remove "ÿþ" from begin?
Thanks,
Szostak. _________________ WMB 6.1.005 |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Feb 21, 2011 10:46 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
fszostak wrote: |
I have same problem.... how to fix?? how to remove "ÿþ" from begin? |
It's the Byte Order Mark.
You can either remove it using "substring".
Or you can do the correct thing and ensure that you use the correct codepage to indicate that there is a Byte Order Mark before the UTF-16 data. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Feb 21, 2011 10:47 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
fszostak wrote: |
I have same problem.... how to fix?? |
As my most worthy associate points out:
kimbert wrote: |
Any XML processor should tolerate a BOM, so it should not be necessary to remove it. |
But if you're certain you have the same problem as this year old post, you should follow the advice he gave. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Feb 21, 2011 10:47 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
fszostak wrote: |
I have same problem.... how to fix?? how to remove "ÿþ" from begin?
Thanks,
Szostak. |
By setting the right CCSID on the sender (1200,1201,1202)  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|