我能够从Java
到Websphere MQ
on发送消息AS400
。如果我从 发送消息,如果我使用任何可访问的,包括完整的语言本地化,WinXP
没有区别;Locale
英文也没有问题Locale
。正确编码的重要之处只有以下代码行:
msgId.characterSet = 1208;
不幸的是,它是无效的。我想从中获取消息的情况有所不同MQ Queue
。
如果我
MQ Queue
从 Windows 操作系统(没有任何语言包的英语)收到消息,我可以从表单MQ Queue
中获取消息。String
如果 Windows 操作系统使用某些语言包完全本地化,我会收到异常
消息缓冲区发生异常: java.io.UnsupportedEncodingException: Cp870
来自代码(从 try - 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
我对from没有任何问题MQMessage#getBytes