Author |
Message
|
sindeman |
Posted: Thu Nov 02, 2006 5:02 am Post subject: base Java API readString UnsupportedEncodingException: Cp850 |
|
|
Newbie
Joined: 22 Feb 2006 Posts: 3
|
Using MQC.MQGMO_CONVERT and reading data from the message with readString leads to an exception:
- Java.io.UnsupportedEncodingException: Cp850 (message put with MQSeries Explorer) or Cp437 (message put with rfhutil)
I dont understand why it performs a conversion in the first place as i put and get on the same platform. I checked the Programming and Reference guide but havent found an answer yet. Any help ismuch appreciated.
Software Version:
- Windows XP Professional SP2
- WebSphere MQ 5.3 CSD05
- jre1.5.0_05
I tried reading data into a StringBuffer with readUnsignedByte(), this works fine (no codepageconversion).
Regards,
Jean-Pierre |
|
Back to top |
|
 |
Vitor |
Posted: Thu Nov 02, 2006 5:12 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Not perhaps directly relevant, but that's an old version you've got there. To be using MQ with Java reliably, you really need to be on CSD 10 or better. Of course, if you're going to upgrade it makes sense to go all the way to CSD 12.
Also, isn't encoding different to CCSID? Not a big Java person, but doesn't the MQMD hold Encoding as a separate value? Related to packed numbers? Is it the same for Java? Don't ask me why it's causing your error (see above re my level of Java) but it occurs that this code page thing might be a red herring. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
sindeman |
Posted: Thu Nov 02, 2006 5:31 am Post subject: |
|
|
Newbie
Joined: 22 Feb 2006 Posts: 3
|
The messagedescriptor holds separate fields for the characterset and encoding.
I know its an old version of MQ but it's the standard installed version we use. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Nov 02, 2006 5:35 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Please see my comments regarding my level of Java...
I still don't get why an UnsupportedEncodingException is connected to a code page issue. Especially when the code pages are equivalent. Still, what do I know about Java??
I accept it's the standard installed version you use. That doesn't change the fact that it's old, unsupported, has poor Java support and you should seriously consider upgrading!  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Nov 02, 2006 6:15 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Nov 02, 2006 3:01 pm Post subject: Re: base Java API readString UnsupportedEncodingException: C |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
sindeman wrote: |
Using MQC.MQGMO_CONVERT and reading data from the message with readString leads to an exception:
- Java.io.UnsupportedEncodingException: Cp850 (message put with MQSeries Explorer) or Cp437 (message put with rfhutil)
I dont understand why it performs a conversion in the first place as i put and get on the same platform. I checked the Programming and Reference guide but havent found an answer yet. Any help ismuch appreciated.
Software Version:
- Windows XP Professional SP2
- WebSphere MQ 5.3 CSD05
- jre1.5.0_05
I tried reading data into a StringBuffer with readUnsignedByte(), this works fine (no codepageconversion).
Regards,
Jean-Pierre |
When putting the messages with these tools make sure the encoding is either 0 (qmgr default) or the correct value. You may need to set the encoding.
Java and especially JMS is very touchy there on the get with convert.
In JMS I have seen the encoding exception on a machine with the full MQ client, whereas the same code run on a machine with the MQ Server, both connecting in client mode to the same queue same message worked... MQ V 6.0.1.0
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Nov 02, 2006 3:19 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
MQGMO, FJ.
not MQPMO. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Nov 02, 2006 3:51 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
jefflowrey wrote: |
MQGMO, FJ.
not MQPMO. |
Yes but the error on the GET/Browse happens because the value on the PUT was not right. (The put will accept as per documentation any integer. Whether this integer makes sense in the way of evaluating the encoding is irrevelant to the put. The get/browse or even a conversion exit will choke on a bad value. Sometimes even on 0.)
We had the case where the MF was putting a message with a specific header (MQSAPH) on the queue and the encoding had to be specified. The default (0) did not carry over well...
 _________________ MQ & Broker admin |
|
Back to top |
|
 |
|