# HG changeset patch # User fuchita # Date 1194947604 -32400 # Node ID b4991de8e83a4df1e16061fe2ba1a5d8307e19f7 # Parent f4eb7fd098c4ea59f15bae76b687979fc07e9c62 UTF-8 Pack Method packUConv()/unpackUConv() add diff -r f4eb7fd098c4 -r b4991de8e83a rep/REPPacketSend.java --- 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();