ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » MQSI and Unicode/UTF-8

Post new topic  Reply to topic
 MQSI and Unicode/UTF-8 « View previous topic :: View next topic » 
Author Message
martin
PostPosted: Mon Nov 26, 2001 12:27 pm    Post subject: Reply with quote

Novice

Joined: 09 Aug 2001
Posts: 17
Location: Charlotte, NC

I need advise on getting a UTF-8 encoded (with extended values) XML file through an MQSI application.

A Java MQ app that feeds the MQSI app is reading in the UTF-8 encoded XML file. The parsed file is now a Java unicode string. The MQMD characterSet is set to 1200 and the unicode string is put in the message body using writeString. The message is put on a queue for MQSI.

If the MQSI app is involved with several internal put/gets and WorkFlow, problems arise from the XML declaration still saying encoding="UTF-8" when it is actually Unicode.

1. Isn't it right to pass the UTF-8 XML as unicode through MQSeries? If I used UTF-8 (1208) characterSet, I would not be able to determine the number of characters for the readString method.

2. If the sending app does pass the UTF-8 XML as unicode, is it supposed to change the XML declaration to say encoding="UCS-2"? If so, how would this message ever make it back to UTF-8 after the MQSI application is done with it?

3. Someone suggested having the MQSI app wipe out or change the offending XML decl encoding attribute.

thanks for any ideas,
Back to top
View user's profile Send private message
mpuetz
PostPosted: Mon Dec 17, 2001 4:35 am    Post subject: Reply with quote

Centurion

Joined: 05 Jul 2001
Posts: 149
Location: IBM/Central WebSphere Services

Hi,

actually, as far as I understand and tested it, MQSI doesn't care a bit about the
encoding statement in your XML message.
It only cares about what's written in the value of CodedCharSetId in your MQMD.
It is the responsibility of the application that does the PUT operation to state the correct codepage in the MQMD header (and for other apps that need the XML-encoding statement to put the correct UTF-8 or USC-2 declaration into the XML message body.
So if your java app doesn't explicitly set
the CodedCharSetId in the MQMD to 1200 (UCS-2) and your message buffer contains 2-byte
unicode your app is lying to MQSeries about
the contents of the message.
If you don't set the codepage at all, MQ
assumes you are generating strings in the
same codepage as the QMgr is running which
could be set to something very different.
(DISPLAY QMGR ALL from runmqsc tells you more)

Note, there is another common pitfall about
codepages, namely that of implicit code page
conversion though MQSeries.
If you send the message through an MQ channel
from one QMgr to another and channel conversion is switched on your message will
be silently converted to the codepage of
the receiving QMgr, but, of course, the XML declaration in your message body is not updated.

One more important note: Take care that
for XML messages your MQMD.Format = 'MQSTR'
otherwise neither MQ nor MQSI can convert
the message content.

Internally MQSI always works with UCS-2
encoding. If you want to change the encoding of a message before MQSI puts to an output queue
you can e.g. do the following in a compute node:

SET OutputRoot.MQMD.CodedCharSetId = 1208;
SET OutputRoot.XML.(XML.XmlDecl).(XML.attr)Encoding = 'UTF-8';

The following output nodes would then encode the message as UTF-8 and it's properly 'documented' in the XML-Declaration.

Hope this helps anybody with similar problems,
Mathias Puetz

IBM-EMEA AIM Services
MQ/MQSI Specialist
Back to top
View user's profile Send private message
mpuetz
PostPosted: Fri Dec 21, 2001 8:00 am    Post subject: Reply with quote

Centurion

Joined: 05 Jul 2001
Posts: 149
Location: IBM/Central WebSphere Services

Minor correction,

you should use the special tag descriptor
XML.Encoding for accessing the Encoding
attribute in the XML descriptor, like

SET OutputRoot.XML.(XML.XmlDesc).(XML.Encoding)Encoding = 'UTF-8';

_________________
Mathias Puetz

IBM/Central WebSphere Services
WebSphere Business Integration Specialist
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » MQSI and Unicode/UTF-8
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.