|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
How to enforce UTF-8 encoding? |
« View previous topic :: View next topic » |
Author |
Message
|
busy_chap |
Posted: Fri Feb 20, 2009 10:25 am Post subject: How to enforce UTF-8 encoding? |
|
|
Acolyte
Joined: 18 May 2006 Posts: 69
|
Hi,
We get french characters from a application with code page 819 and the message format as MQSTR.
our target application needs the data in UTF-8 encoding. Can somebody help me on how do I do that?
Here is what we have but the target data rejects the data syaing it is a invalid byte. Which codepage should I use to convert to UTF-8?
SET OutputRoot.XMLNSC.(XML.XmlDecl) = '';
SET OutputRoot.XMLNSC.(XML.XmlDecl).(XML.Version) = '1.0';
SET OutputRoot.XMLNSC.(XML.XmlDecl).(XML.Encoding) = 'UTF-8';
SET OutputRoot.XMLNSC.{soapenv}:Envelope.{soapenv}:Body.{tns}:executeBOMessage.String_3.(XML.CDataSection) = CAST(ASBITSTREAM(InputRoot.XMLNSC.SendToDO.Value) AS CHARACTER CCSID InputRoot.MQMD.CodedCharSetId); |
|
Back to top |
|
 |
kirank |
Posted: Fri Feb 20, 2009 11:30 am Post subject: |
|
|
 Centurion
Joined: 10 Oct 2002 Posts: 136 Location: California
|
If your are copying MQ headers from Input to Output, make sure you add following statements
SET OutputRoot.Properties.CodedCharSetId = 1208;
SET OutputRoot.MQMD.CodedCharSetId = 1208;
This will set UTF-8 code page for the output message. the ESQL you have only sets the UTF-8 for XML body.
Regards
Kiran |
|
Back to top |
|
 |
kimbert |
Posted: Fri Feb 20, 2009 1:45 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
This
Code: |
SET OutputRoot.XMLNSC.(XML.XmlDecl).(XML.Encoding) = 'UTF-8'; |
just sets the value of the 'Encoding' attribute in the XML declaration. It does not control the code page which message broker uses.
This
Code: |
ASBITSTREAM(InputRoot.XMLNSC.SendToDO.Value) |
should specify a code page, and it should be [edit]1200[/edit] because you are constructing a CHARACTER variable to be put into the message tree.
This
Code: |
CAST(X AS CHARACTER CCSID InputRoot.MQMD.CodedCharSetId);
|
is specifying InputRoot.MQMD.CodedCharSetId when it should be specifying [edit]1200[/edit]. |
|
Back to top |
|
 |
busy_chap |
Posted: Fri Feb 20, 2009 7:54 pm Post subject: |
|
|
Acolyte
Joined: 18 May 2006 Posts: 69
|
Kiran/Kimbert... you guys are the greatest. My issue is resolved. I enforced the charcode on the output msg to be 1208 and it resolved my issue.
If you guys don't mind, can you tell me how do you know so much about CCSID? Can you suggest me some links to where I can find subjects related to CCSID?
Thanks again! |
|
Back to top |
|
 |
rekarm01 |
Posted: Fri Feb 20, 2009 9:20 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
ccsid=1200 is ok here, but other ccsids will also work (such as 1208, or InputRoot.Properties.CodedCharSetId), as long as:- both the ASBITSTREAM() and CAST() functions specify the same CCSID,
- and the code page(s) for the given CCSID define all the characters that might appear in the message.
busy_chap wrote: |
Can you suggest me some links to where I can find subjects related to CCSID? |
There's the broker documentation itself, (available online, or through your broker toolkit help), for the CREATE statement, ASBITSTREAM function, and CAST function.
There's also more detailed references for IBM CCSIDs, and for Unicode. |
|
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
|
|
|
|