Mercurial > hg > RemoteEditor > REPSessionManager
changeset 48:b4991de8e83a
UTF-8 Pack Method packUConv()/unpackUConv() add
author | fuchita |
---|---|
date | Tue, 13 Nov 2007 18:53:24 +0900 |
parents | f4eb7fd098c4 |
children | f8b4101746d2 |
files | rep/REPPacketSend.java |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/rep/REPPacketSend.java Tue Nov 13 17:36:27 2007 +0900 +++ b/rep/REPPacketSend.java Tue Nov 13 18:53:24 2007 +0900 @@ -10,7 +10,9 @@ public class REPPacketSend { SocketChannel socketchannel; - + // JIS/S-JIS = 2, UTF-8 = 3, UTF-?? = 5 + final int CHAR_ORDER = 3; + public REPPacketSend(SocketChannel sc){ socketchannel = sc; } @@ -37,7 +39,7 @@ if(command.string == null){ command.setString("test"); } - ByteBuffer buffer = ByteBuffer.allocateDirect(24+(command.string).length()*5); + ByteBuffer buffer = ByteBuffer.allocateDirect(24+(command.string).length()*CHAR_ORDER); buffer.clear(); // position = 0 buffer.putInt(command.cmd); buffer.putInt(command.sid); buffer.putInt(command.eid); buffer.putInt(command.seq); buffer.putInt(command.lineno); @@ -65,7 +67,7 @@ public void send(REPCommand command){ try { - socketchannel.write(pack(command)); + socketchannel.write(packUConv(command)); //System.out.println(command.toString()); } catch (IOException e) { e.printStackTrace();