mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-07 08:39:17 +00:00
Fix String attribute encoding delimiter
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package org.apollo.game.model.entity.attr;
|
package org.apollo.game.model.entity.attr;
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,11 +32,11 @@ public final class StringAttribute extends Attribute<String> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] encode() {
|
public byte[] encode() {
|
||||||
byte[] bytes = value.getBytes(Charset.forName("UTF-8"));
|
byte[] bytes = value.getBytes(StandardCharsets.UTF_8);
|
||||||
int length = bytes.length;
|
int length = bytes.length;
|
||||||
|
|
||||||
bytes = Arrays.copyOf(bytes, length + 1);
|
bytes = Arrays.copyOf(bytes, length + 1);
|
||||||
bytes[length - 1] = 0;
|
bytes[length] = 0;
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user