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 » Help with encoding exception when doing a GET

Post new topic  Reply to topic
 Help with encoding exception when doing a GET « View previous topic :: View next topic » 
Author Message
AlexeiSkate
PostPosted: Tue May 14, 2002 2:59 pm    Post subject: Help with encoding exception when doing a GET Reply with quote

Centurion

Joined: 10 Apr 2002
Posts: 123

Hi,

I put a string of characters, e.g. "Hello World", onto a queue. Now I do a get and I want to display the returned string using System.out.println. I tried using MQMessage.readLine() or MQMessage.readString( MQMesage.getMessageLength ), but I keep getting the "java.io.UnsupportedEncodingException: cp437".

Do I need to set the 'characterSet' attribute of MQMessage to some valid value when doing a PUT and then do a GET with the same value for 'characterSet' ?

thanks,
Alex
Back to top
View user's profile Send private message
amurugan
PostPosted: Wed May 15, 2002 12:02 am    Post subject: Reply with quote

Voyager

Joined: 10 Sep 2001
Posts: 75
Location: india

hi ,
why dont u try with MQMessage.readUTF() or MQMessage.readString() . Let me know whether this helped you

Regards,
Murugan
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
AlexeiSkate
PostPosted: Wed May 15, 2002 5:58 am    Post subject: Reply with quote

Centurion

Joined: 10 Apr 2002
Posts: 123

Greetings,

Thanks for the reply. I put a msg into the queue by selecting the queue from the Explorer and selecting "Put Test Message".

The readUTF() function worked for like the first 2-3 times I ran my GET program but after that, it started giving out the IOException error everytime. Strange. The readString( length ) was giving me EncodingException.

I read in the MQS for Java redbook that the default character set identifier for application message data is CharacterSet 819. So I'm assuming that the msg that I put onto the queue is encoded with the 819 characterSet (I don't quite yet understand all of this encoding stuffs). So in my code, I set the CharacterSet property to 819 before doing a GET and it seems to work:

MQMessage.characterSet = 819
localQueue.get( MQMessage, GMO )
int len = MQMessage.getTotalMessageLength()
String myMsg = MQMessage.readString( len )
System.out.println(myMsg)

(1)Is it normal that I have set the characterSet in order to be able to retrived my msg in a readable text format ?
(2) When I do a PUT, do I also have to set the characterSet for the msg also ?
Back to top
View user's profile Send private message
AlexeiSkate
PostPosted: Wed May 15, 2002 11:05 am    Post subject: Reply with quote

Centurion

Joined: 10 Apr 2002
Posts: 123

Actually I take back the part about setting the characterSet variable. I notice in my code that I have a GetMessageOptions set to MQC.MQGMO_CONVERT, and I believe that is what causing the attempt to convert the retrieved data.

I removed the CONVERT option for GMO and also removed the line that set the characterSet value. I ran my program using readString(len) and it displayed the text characters fine to standard output.
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 » IBM MQ Java / JMS » Help with encoding exception when doing a GET
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.