I'm able to send messages from Java
to Websphere MQ
on AS400
. If I send messages from WinXP
, there is no difference if I use any accessible Locale
, including full Language Localization; nor is there a problem with English Locale
. Important for correct encoding is only this code line:
msgId.characterSet = 1208;
Infortunately, it's not valid. There are differences in the case that I want to take the message from MQ Queue
.
In the case that I get message from
MQ Queue
from Windows OS (English without any of Language Pack), I'm able to take message fromMQ Queue
inString
form.In the case that Windows OS is Full Localized with some of Language Pack, I am receiving an exception
Exception occured while to message buffer : java.io.UnsupportedEncodingException: Cp870
from code (removed balast from try - catch - finally block)
try {
Class.forName("com.ibm.mq.MQEnvironment");
MQEnvironment.hostname = hostname;
MQEnvironment.port = port1;
MQEnvironment.channel = channel;
MQEnvironment.userID = userID;
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES);
try {
qmgr1 = new MQQueueManager(qmanager);
MQGetMessageOptions gmo = new MQGetMessageOptions();
int openOptions2 = MQC.MQOO_INPUT_SHARED;
gmo.options = MQC.MQGMO_NO_SYNCPOINT; //Set no sync point
gmo.options = MQC.MQGMO_CONVERT; //Handles ASCII/EBCDIC
gmo.options = MQC.MQGMO_WAIT; //Wait until message arrives
gmo.waitInterval = 3000;
getq = qmgr1.accessQueue(responseQueue, openOptions2);
while (true) {
try {
responseFromQUEUE = "";
MQMessage msgId = new MQMessage();
//putmsg.characterSet = 437;// Set code page to ASCII
//putmsg.characterSet = 1200;// Set code page to UNICODE
msgId.characterSet = 1208;
getq.get(msgId, gmo);
String str = msgId.readLine();
//responseFromQUEUE = CpConv.tf870to1250(msgId.readLine());
//own EncodePage doesn't works too
if (responseFromQUEUE.length() == 0) {
break;
}
} catch (MQException mqx) {
if (mqx.reasonCode == EMPTY_QUEUE) {
} else {
}
}
}
} catch (MQException mqx) {
} finally {
}
} catch (IOException ex) {
} catch (ClassNotFoundException e) {
}
please
is there some parameter(s), something that I miss there for take
String
fromMQMessage#readLine()
my question here is only about
String
conversion,I haven't any issue with
Encode
fromMQMessage#getBytes