Websphere MQ 中文乱码解决
只说需要注意的!
private int CCSID=1383
发送端:
MQMessage mqMessage = new MQMessage();
mqMessage.encoding=CCSID;
mqMessage.characterSet=CCSID;
mqMessage.writeString(msg);
红色添加上
同样接收端:
MQMessage inMsg = new MQMessage();
inMsg.characterSet=CCSID;
inMsg.encoding=CCSID;
mqQueue.get(inMsg, gmo);
String xml = inMsg.readStringOfByteLength(inMsg.getMessageLength());
也就是说MQMessage在new之后加设置characterSet=CCSID,encoding=CCSID