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 » IBM MQ Java / JMS » base Java API readString UnsupportedEncodingException: Cp850

Post new topic  Reply to topic
 base Java API readString UnsupportedEncodingException: Cp850 « View previous topic :: View next topic » 
Author Message
sindeman
PostPosted: Thu Nov 02, 2006 5:02 am    Post subject: base Java API readString UnsupportedEncodingException: Cp850 Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Thu Nov 02, 2006 5:12 am    Post subject: Reply with quote

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
View user's profile Send private message
sindeman
PostPosted: Thu Nov 02, 2006 5:31 am    Post subject: Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Thu Nov 02, 2006 5:35 am    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Thu Nov 02, 2006 6:15 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

If you specify MQGMO_CONVERT, and the data doesn't need to be converted, you get back a warning telling you that conversion hasn't been done.

In the case of Java, this is turned into an Exception.

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/topic/com.ibm.mq.csqzak.doc/csqzak10306.htm
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Nov 02, 2006 3:01 pm    Post subject: Re: base Java API readString UnsupportedEncodingException: C Reply with quote

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
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Thu Nov 02, 2006 3:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Thu Nov 02, 2006 3:51 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » base Java API readString UnsupportedEncodingException: Cp850
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.