转载

当eclipse发送报文乱码时,在java代码中发送和接收的地方都改成utf-8编码即可

/fms_web/src/com/joyintech/business/counter/common/SendUtils.java

//发送报文至核心
byte[] info=Utils.convert(sendMsg);
byte[] bMsg = process(info,ip,port);
message = new String(bMsg, "GBK");--> message = new String(bMsg, "utf-8");

当eclipse发送报文乱码时,在java代码中发送和接收的地方都改成utf-8编码即可

/fms_interf/src/com/joyintech/FmsSaleServer/CommunicateCall/Communicate/SocketServer/SocketServerWork.java、

BufferedReader is = new BufferedReader(new InputStreamReader(socket.getInputStream()),"utf-8");

转载于:https://www.cnblogs.com/ljsn/p/6039126.html

正文到此结束
本文目录