|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Encoding issues with special characters |
« View previous topic :: View next topic » |
Author |
Message
|
vp_wmb |
Posted: Wed Jul 22, 2009 3:08 pm Post subject: Encoding issues with special characters |
|
|
Newbie
Joined: 22 Jul 2009 Posts: 1
|
Hi,
I've looked through the fourm and searched on the net and am still a bit confused how code pages and encoding work with character sets. I've tried the recommendations mentioned on the forum but none of them worked. My initial thought is that what i'm trying to do probably won't work but wanted to see what people on this forum thought. So here is the problem:
I have a message flow which creates a XML message with special characters embedded in the message.
I write the created message with a CCSID of 1208 and write it file and a mq queue.
I view the message in XML spy witha utf-8 declaration and i can see all of the special characters properly.
I write another flow to pick up the message from the queue and then debug the flow and the special characters appear fine.
I now write another flow to pick on the message from the queue and try and convert the xml message to write it into a element in a new xml message. However this fails and I get an error.
I've attached the code below along with the error:
The following is an example of the message that is creates a new xml message with the special character:
SET OutputRoot.MQMD.CodedCharSetId = 1208;
SET OutputRoot.XMLNSC.a.b = 'Ø';
SET OutputRoot.XMLNSC.a.c = '£';
SET OutputRoot.XMLNSC.a.d = 'Ã';
The following is an example of the message that I try to create using the xml message above:
CREATE LASTCHILD OF OutputRoot.XMLNSC NAME 'Msg';
CREATE LASTCHILD OF OutputRoot.XMLNSC.Msg NAME 'Out';
SET OutputRoot.XMLNSC.Msg.Out.(XML.CDataSection) = CAST ASBITSTREAM(InputBody) AS CHARACTER CCSID 1208);
Now the converting from the input XML message to BLOB works, but the converting of BLOB to CHAR fails with the following message:
Source character ''9d'' in field ''3c613e3c623e9d3c2f623e3c633e9c3c2f633e3c643ea13c2f643e3c2f613e'' cannot be converted to Unicode from codepage '1208'.
The source character is an invalid code point within the given codepage.
My question is what code page supports this as I have looked across the forum and internet and cant seem to find anything that helps. Am I using the wrong code page? or am i missing something out? or is this just plain wrong?
It would useful if an explanation was given rather than "go to this link and try and find out yourself" as I've tried that and i've got nowhere!
Thanks in advance. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jul 22, 2009 7:48 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Open a PMR...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rekarm01 |
Posted: Sun Jul 26, 2009 2:30 pm Post subject: Re: Encoding issues with special characters |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
vp_wmb wrote: |
The following is an example of the message that is creates a new xml message with the special character:
Code: |
SET OutputRoot.MQMD.CodedCharSetId = 1208;
SET OutputRoot.XMLNSC.a.b = 'Ø';
SET OutputRoot.XMLNSC.a.c = '£';
SET OutputRoot.XMLNSC.a.d = 'Ã'; |
|
On a side note, the toolkit ESQL Editor Text file encoding is configurable. If multiple developers are sharing an ESQL file containing non-ASCII characters, then they should all be using the same Text file encoding.
vp_wmb wrote: |
The following is an example of the message that I try to create using the xml message above:
Code: |
SET OutputRoot.XMLNSC.Msg.Out.(XML.CDataSection)
= CAST(ASBITSTREAM(InputBody)
AS CHARACTER CCSID 1208); |
|
vp_wmb wrote: |
Now the converting from the input XML message to BLOB works ... |
Well, it doesn't throw an Exception anyway. But, it also doesn't quite work as expected.
vp_wmb wrote: |
Source character ''9d'' in field ''3c613e3c623e9d3c2f623e3c633e9c3c2f633e3c643ea13c2f643e3c2f613e'' cannot be converted to Unicode from codepage '1208'.
The source character is an invalid code point within the given codepage. |
It looks like ASBITSTREAM() is encoding characters using ccsid=850, (where 'Ø' -> X'9d, '£' -> X'9c', and 'Ã' -> X'a1'). Whichever ccsid it's using, it's definitely not ccsid=1208.
ASBITSTREAM() might work better with an additional clause, such as "OPTIONS EmbeddedBitStream", or "CCSID 1208".
Two (or more) conversions performed in sequence must follow this general pattern:- convert from A to B
- convert from B to C
... where the from encoding in one step matches the to encoding in the previous step.
It does not make sense to convert to ccsid=850 in one step, and then try to convert from ccsid=1208 in the next step. |
|
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
|
|
|
|