Monday 03 November, 2008 (.Net | BizTalk | Fixes | Java)
Working with Websphere MQ and the MQSC adapter is quite new for me and I have been struggling with a couple of problems which have been very difficult to find solutions to. One of our main issues has been getting the correct character encoding of outgoing messages to MQ. BizTalk would output the message with the correct encoding (using a file send port to verify) and it looked like the messages on the WebSphere MQ queue were correctly encoded when we checked them using rhutilc. In our case we encoded our unicode messages as UTF-8 but when the Java system which is the destination read the messages any non-standard US characters came out as rubbish. They were correctly encoded as two bytes in the message but the destination system was reading them using codepage 850. Also all unicode messages that the Java system sent to us encoded with UTF-8 over MQ worked correctly in BizTalk.
What I have found out through much trial and error and the sparse clues I have been able to find on the Internet is that the WebSphere client that BizTalk uses under the covers will set the character encoding of any messages that you write to the systems default codepage, which for windows is 850 according to IBM. This setting does not take into account the actual encoding that BizTalk 2006 has done to the message. If you force your message to be encoded as 850 in BizTalk then it will most likely work as long as you don't use characters that are outside the codepage. There is a context property in MQSeries.dll called MQMD_CodedCharSetId which will allow you to set the codepage value (CCSID in the MQ world) for your outgoing message.
I have found three ways to remedy the encoding problem:
One important point to remember is that UTF-8 is codepage 65001 in Windows but 1208 in IBM, so wherever you set the codepage you need to have this in mind - as far as I know all other codepages have the same ids.
Using rfhutilc you can verify the codepage of a message in an MQ queue by browsing to the message and then checking what codepage has been set under the MQMD tab.
I have not verified this but the solutions that I have outlined above should work for EBCDIC and any other odd encodings that you may require as long as you can actually create a message with that encoding.
« Add intellisense for any file extension in... | Latest | Reflections on three days at Tech Ed »
Remember Me
b, i, strike
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
Sign In
.Net (25) About (1) Agile (2) AJAX (1) Architecture (4) BizTalk (4) Blogging (12) Bugs (11) Business (2) dasBlog (9) EDA (1) Fixes (12) FlexWiki (1) Games (1) Geek (4) GTD (2) Humor (4) Interviews (1) Java (2) Office (1) Ramblings (8) Reviews (7) Scrum (2) Security (1) SharePoint (6) SOA (4) Speaking (2) Team System (10) Tech Ed 2008 (1) TechEd 2006 (5) Tips (4) Vista (1) Visual Studio (2) Web (11) Web2.0 (1) XP (1)