Author |
Message
|
nize |
Posted: Thu Nov 12, 2009 2:16 am Post subject: Validation of CCSID |
|
|
Voyager
Joined: 02 Sep 2009 Posts: 90
|
Hi,
I would like to know if you guys have any idea on a way to validate the CCSID of a BLOB in a WMQ/WMB environment.
Background:
sourceApp -> WMBFlow -> targetApp
The transport is WMQ (JMS).
The sourceApp uses a DB using Windows-1252, but the targetApp is limited to a DB using 8859-1. A table showing the differences in supported character repertoire is provided in http://www.alanwood.net/demos/charsetdiffs.html#a.
The programs transforming from/to DB/JMS use a UTF-8 encoding of the JMS messages. Therefore, the JMS pipe is not a bottleneck when it comes to characters.
Problem:
I want to ensure that no crap characters are stored in the DB of the targetApp. This validation must occur in WMQ/WMB since the sourceApp can not be trusted.
Solution idea:
In the WMBFlow: decode the BLOB to a STRING and then try to CAST the STRING to 8859-1. If it fails => message returned to sender. If it is successful: => forward the original message to the targetApp.
What do you think? Do you have other ideas? |
|
Back to top |
|
 |
Gaya3 |
Posted: Thu Nov 12, 2009 8:38 am Post subject: |
|
|
 Jedi
Joined: 12 Sep 2006 Posts: 2493 Location: Boston, US
|
|
Back to top |
|
 |
nize |
Posted: Thu Nov 12, 2009 12:39 pm Post subject: |
|
|
Voyager
Joined: 02 Sep 2009 Posts: 90
|
hm... ok, I see that it is related, but could you please be a little bit more specific on which conclusions to make from it in the context of this topic?
 |
|
Back to top |
|
 |
kimbert |
Posted: Thu Nov 12, 2009 4:44 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Solution idea:
In the WMBFlow: decode the BLOB to a STRING and then try to CAST the STRING to 8859-1. If it fails => message returned to sender. If it is successful: => forward the original message to the targetApp.
|
So you're proposing the following:
Code: |
SET myUnicodeString = CAST sourceBLOB AS CHARACTER CCSID 1252;
SET targetBLOB = CAST myUnicodeString AS BLOB CCSID 8859-1;
-- Error handler catches any character conversion exceptions and returns message to sender
|
Sounds reasonable enough to me, altthough I suspect there are others better qualified than me to advise on this. |
|
Back to top |
|
 |
nize |
Posted: Fri Nov 13, 2009 4:58 am Post subject: |
|
|
Voyager
Joined: 02 Sep 2009 Posts: 90
|
Yes, exactly!
Quote: |
I suspect there are others better qualified than me to advise on this.
|
Dont be humble
Still, if anybody knows a better way to achieve my goal I am interested! |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Nov 13, 2009 7:34 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
kimbert means that he doesn't spend a lot of time *using* broker, so he's not terribly qualified to help with usage questions.
I suppose another mechanism would be to parse each character in the string individually.
But it seems like taking the long way around. |
|
Back to top |
|
 |
smdavies99 |
Posted: Fri Nov 13, 2009 8:11 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
mqjeff wrote: |
I suppose another mechanism would be to parse each character in the string individually.
|
I have seen this method adopted in a system that was originally deployed using V2.1 and is still being used today under V6. IMHO, it is not elegant but does work. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
|