Posted: Wed Aug 10, 2005 12:11 pm Post subject: How to convert XML message coming in UTF-8 to Shift_JIS
Acolyte
Joined: 01 Feb 2005 Posts: 62
Hi
I am having trouble converting data coming to WBI in UTF-8 format. I receive this data from SAP using mySap adapter. XML has UTF-8 encoding. I need to convert this data to Shift_JIS and insert into DB2. I tried changing the conversion options on input node and also wrote esql code in a compute node before my insert statement to convert from utf-8 to Shift_JIS(932). But no use. If I try to use 932 as my encoding number in a create field command while parsing a blob taken from utf-8, I am getting parsing errors. If I give 932 in the input node properties, I don't see any change in the data. I am getting MQRFH2 header also.
can some one help me out. I am totally lost how to convert this ??
[quote="jefflowrey"]It won't be converted until you put it to an MQOutput, or run it through ASBITSTREAM.
As long as the data is inside a message flow, it is Unicode.[/quote]
Thanks for the response. Even I am doing asbitsteam. But when I try to parse the blob I got from asbitstream using 932 I am getting parsing error. It is not able to parse these characters.
DECLARE CHARS1208 BLOB;
--DECLARE vEncodingStr Char '<?xml version="1.0" encoding="Shift_JIS"?>';
DECLARE vEncodingStr Char '3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D2253686966745F4A4953223F3E';
Declare vEncodingBlob Blob;
Set vEncodingBlob = Cast(vEncodingStr As Blob);
Set CHARS1208 = ASBITSTREAM(InputRoot.MRM ENCODING InputRoot.MQRFH2.Encoding
CCSID InputRoot.MQRFH2.CodedCharSetId
SET InputRoot.Properties.MessageSet
TYPE InputRoot.Properties.MessageType
FORMAT InputRoot.Properties.MessageFormat);
Set CHARS1208 = vEncodingBlob||Substring(CHARS1208 From 39);
CREATE LASTCHILD OF Environment.Variables.Name819 DOMAIN 'MRM' PARSE(CHARS1208 ENCODING 273 CCSID 932
SET InputRoot.Properties.MessageSet
TYPE InputRoot.Properties.MessageType
FORMAT InputRoot.Properties.MessageFormat);
I can see the error message in the Environment.Variables.MRM
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