Archived
0

fix: unicode in chat

This commit is contained in:
2019-02-09 16:44:59 +03:00
parent 4a7790cd72
commit c89f3e9356
2 changed files with 2 additions and 2 deletions

View File

@@ -32,7 +32,7 @@ public abstract class NetOutputStream_p340 extends NetOutputStream {
writeBytes(buf);
} else {
byte[] buf = value.getBytes(StandardCharsets.UTF_8);
writeVarInt(value.length());
writeVarInt(buf.length);
writeBytes(buf);
}
}

View File

@@ -221,7 +221,7 @@ class ByteArrayOutputNetStreamTest {
final byte[] strBytes = string.getBytes(StandardCharsets.UTF_8);
final byte[] bytes = new byte[strBytes.length + 1];
bytes[0] = (byte) string.length(); // здесь считается, что размер поместится в один байт
bytes[0] = (byte) strBytes.length; // здесь считается, что размер поместится в один байт
System.arraycopy(strBytes, 0, bytes, 1, strBytes.length);
assertArrayEquals(bytes, byteArrayOutputNetStream.toByteArray());