|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
EBCDIC 937 convert to Chinese Big5 950 error |
« View previous topic :: View next topic » |
Author |
Message
|
Vengoal Chang |
Posted: Mon Dec 24, 2001 2:30 am Post subject: |
|
|
Newbie
Joined: 23 Dec 2001 Posts: 8
|
I wrote as following :
/** Write a message */
protected void writeMessage () {
String text = messageTextArea.getSelectedText();
if (null != text) { // If we have a selected body to send
if (isConnected()) { // If we're connected
MQMessage mqMessage = new MQMessage();
mqMessage.format = MQC.MQFMT_STRING;
mqMessage.characterSet = 937;
try {
mqMessage.writeString(text); // Set the message
try {
queue.put(mqMessage);
}
catch (MQException ex) {
showException(ex);
}
}
catch (java.io.IOException ex) {
showException(ex);
}
}
}
else {
messageTextArea.append("n---n You must select (hilite) text to be used for the message text.n---n");
}
}
/** Append the text contents of a message to the display
* @param mqMessage Any MQMessage
*/
protected void displayMessage (MQMessage mqMessage) {
int msgLen = mqMessage.getTotalMessageLength();
String contents = "";
if (0 < msgLen) {
byte b[] = new byte [msgLen];
try {
//mqMessage.readFully(b);
// contents = new String (b);
mqMessage.characterSet = 950;
contents = mqMessage.readString(msgLen);
}
catch (java.io.IOException ex) {
showException(ex);
}
}
messageTextArea.append("n<MESSAGE-TEXT>" + contents + "</MESSAGE-TEXT>n");
}
Above function write message work normal,
the as/400 receive the converted message is
right. But when read the message from as/400
. I got the following error:
java.io.EOFException
at com.ibm.mq.MQMessage.readConvertedString(MQMessage.java:833)
at com.ibm.mq.MQMessage.readString(MQMessage.java:786)
at QBrowser.displayMessage(QBrowser.java:617)
What's happened ? What'm I missed ?
|
|
Back to top |
|
 |
middlewareonline |
Posted: Mon Dec 24, 2001 11:23 am Post subject: |
|
|
Acolyte
Joined: 09 Jul 2001 Posts: 73
|
looks like conversion is not happining. Have you included i18n.jar file in the classpath. This comes with JDK. if you don't have it download it from sun.
MiddlewareOnline.com
_________________ ---------------------------------------------
IBM & SUN (J2EE) Certified Consultants,
http://www.MiddlewareOnline.com
A "SARVAM" Online Portal
http://www.SARVAM.com
--------------------------------------------- |
|
Back to top |
|
 |
Vengoal Chang |
Posted: Mon Dec 24, 2001 11:54 pm Post subject: |
|
|
Newbie
Joined: 23 Dec 2001 Posts: 8
|
I added the i18n.jar to classpath still driven same error excepition.
I thought that is the IBM MQ JAVA bug.
I read the manual MQSeries Application
Programming reference Code page conversion table, the MQ support
OS/400 ccsid 937 <-> PC NT CCSID 950.
On AS/400 Qmanager CCSID is 937 and I set my PC MQENVIRONMENT.CCSID is 950.
When I put a MESSAGE with CCSID 937 to AS/400, then I browse the message is converted normal.
I get the message from AS/400 have two condition as following :
1. when sent english text message, I could get the message from as/400 normal, and the result is right.
2. when sent message with both english and chinese message to AS/400, the message on AS/400 also converted rightly. But I get the message from AS/400, then I got the following excepition message:java.io.EOFException
at com.ibm.mq.MQMessage.readConvertedString(MQMessage.java:833)
at com.ibm.mq.MQMessage.readString(MQMessage.java:786)
at QBrowser.displayMessage(QBrowser.java:622)
Who can give me some help ?
|
|
Back to top |
|
 |
Vengoal Chang |
Posted: Mon Dec 31, 2001 12:03 am Post subject: |
|
|
Newbie
Joined: 23 Dec 2001 Posts: 8
|
I found the problem was driven from Uni-code characters number,If I use the following:
1. Client String Str950 = "Test" + 2 DBCS chars(4 bytes);
So the Str950's length = 8,
When sent to AS/400, the system will convert the string to CCSID 937 and add DBCS control code pair '0E', '0F' between DBCS chars.
2. So the result string like the following:
"Test" + "0E" + 2 DBCS chars + "0F"
and the converted string length = 10.
3. when Java Client get the message from AS/400 using MQMessage readString method with parameter length should be 6.
Because Uni-code base is char base, not byte base. "Test" + 2 DBCS chars.
Finally, the DBCS data in message should be take more effort to process it. How many control code in the message is very hard to take care, need two read process,
first read message without remove is caculate control code pair & culate real readString length,
second readString(real-length).
this will be performance issue for heavy DBCS processing. |
|
Back to top |
|
 |
EddieA |
Posted: Wed Jan 02, 2002 11:00 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Have you tried with the latest version of MA88.
There were problems with some of the earlier versions dealing with UNICODE.
Cheers,
_________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
Vengoal Chang |
Posted: Wed Jan 02, 2002 11:24 pm Post subject: |
|
|
Newbie
Joined: 23 Dec 2001 Posts: 8
|
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|