Merge pull request #10 from kyouji/v3

fix(TCP协议): 优化字符串中文乱码的问题
This commit is contained in:
老周 2023-03-09 10:22:29 +08:00 committed by GitHub
commit 317dd7df8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -157,9 +157,9 @@ public enum DataType {
@Override
public void write(ByteBuf buf, Object value) {
String str = (String) value;
buf.writeShort(str.length());
buf.writeBytes(str.getBytes());
byte[] bytes = ((String) value).getBytes();
buf.writeShort(bytes.length);
buf.writeBytes(bytes);
}
},
//0x0C