我能够从发送消息Java到Websphere
MQ上AS400。如果我从发送消息WinXP,则使用任何可访问性Locale(包括完整的语言本地化)都没有区别;英语也没有问题Locale。正确的编码很重要,只有以下代码行:
msgId.characterSet = 1208;
不幸的是,这是无效的。我要从中获取消息的情况有所不同MQ Queue。
在我得到消息的情况下MQ Queue,从Windows操作系统(英语,没有任何语言包),我能够把消息来自MQ Queue于String形式。
如果Windows操作系统使用某些语言包进行了完全本地化,则我将收到一个例外
消息缓冲区发生异常:
java.io.UnsupportedEncodingException:Cp870
从代码中删除(从尝试中删除balast-catch-finally块)
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) {
}
请
是否有一些参数,我想String从那里拿走一些MQMessage#readLine()
我的问题只是关于String转化,
我没有任何问题与Encode从MQMessage#getBytes