Author |
Message
|
ramjcp |
Posted: Mon Jul 23, 2007 2:34 am Post subject: Getting EOF Exception when using ReadUTF |
|
|
Newbie
Joined: 23 Jul 2007 Posts: 3
|
HI All
My requirement is my MQMessage contains some japanese characters,which i need to read it and process it accordingly
so i have developed the following code for but it is not working , i am getting exception
code is
[code]
byte msgBytes[] = null;
int msgLength = 0;
String msgInString = null;
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = MQC.MQGMO_SYNCPOINT | MQC.MQGMO_WAIT;
MQMessage myMessage = new MQMessage();
queue.get(myMessage, gmo);
msgLength = myMessage.getMessageLength();
msgBytes = new byte[msgLength];
msgInString=myMessage.readUTF();
[/code]
when that last line is getting executed i am getting EOFException.
can any one suggest me how to read japanses characters from MQMessage,
i have tried in another way there is no exception, but the generated string is not japanse. the code i used for it instead of ReadUTF
[code]
myMessage.readFully(msgBytes);
msgInString = new String(msgBytes,"UTF-8");[/code]
i hope that i would get some solution for this...
waiting for reply with anticipation |
|
Back to top |
|
 |
Vitor |
Posted: Mon Jul 23, 2007 2:39 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Was the original message actually written using a UTF method or is it a simple string holding extended Japanese character values? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jul 23, 2007 2:43 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You need as well to look at CCSID conversion. Make sure the message has format = MQFMT_STRING. Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
ramjcp |
Posted: Mon Jul 23, 2007 2:50 am Post subject: |
|
|
Newbie
Joined: 23 Jul 2007 Posts: 3
|
its just a simple string containing japanese characters |
|
Back to top |
|
 |
Vitor |
Posted: Mon Jul 23, 2007 2:54 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
ramjcp wrote: |
its just a simple string containing japanese characters |
Then readUTF won't work.
Read it as a string and convert it as fjb_saper correctly suggests. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jul 23, 2007 2:56 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
ramjcp wrote: |
its just a simple string containing japanese characters |
Make sure your message format is MQFMT_STRING. Make sure the message's CCSID corresponds to the content. Use the CONVERT option with your get. Make sure there is automatic conversion from the source CCSID to the target CCSID. All this being taken care of you should see the japaneese characters...
Enjoy
Between us I would use Unicode (UTF-16) CCSID 1200...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
ramjcp |
Posted: Mon Jul 23, 2007 3:35 am Post subject: |
|
|
Newbie
Joined: 23 Jul 2007 Posts: 3
|
can you provide me any sample code or any link , so that i can acheive this |
|
Back to top |
|
 |
Vitor |
Posted: Mon Jul 23, 2007 4:13 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
ramjcp wrote: |
can you provide me any sample code or any link , so that i can acheive this |
Most of the samples employ these options. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|