mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-23 08:50:52 +01:00
Fix encoding for appended strings
If a packet is constructed using the expression form, PacketStringUtils will encode properly the string like this: String latin = new String(actualString.toString().getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1); This does not happen if the packet is constructed using the Object... constructor, and packets like this: new HPacket(10, 2, 100000, "Dragón de Fuego Azul", 3).toExpression(); will show � instead of ó. Whereas: new HPacket("{l}{h:10}{i:2}{i:100000}{s:\"Dragón de Fuego Azul\"}{i:3}").toExpression(); would display the string correctly.
This commit is contained in:
parent
89da267a33
commit
56cc99e0e6
@ -491,6 +491,7 @@ public class HPacket implements StringifyAble {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public HPacket appendString(String s) {
|
public HPacket appendString(String s) {
|
||||||
|
s = new String(s.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1);
|
||||||
return appendString(s, StandardCharsets.ISO_8859_1);
|
return appendString(s, StandardCharsets.ISO_8859_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user