From 14b4f6e0601f17803fabd41f7da4f7add9c92f64 Mon Sep 17 00:00:00 2001 From: sirjonasxx <36828922+sirjonasxx@users.noreply.github.com> Date: Fri, 23 Apr 2021 02:51:42 +0200 Subject: [PATCH] bugfix in expression parsing - strings --- .../misc/packetrepresentation/PacketStringUtils.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/G-Earth/src/main/java/gearth/misc/packetrepresentation/PacketStringUtils.java b/G-Earth/src/main/java/gearth/misc/packetrepresentation/PacketStringUtils.java index a71b9b7..c046bdc 100644 --- a/G-Earth/src/main/java/gearth/misc/packetrepresentation/PacketStringUtils.java +++ b/G-Earth/src/main/java/gearth/misc/packetrepresentation/PacketStringUtils.java @@ -124,10 +124,13 @@ public class PacketStringUtils { } } actualString.append(match); + String latin = new String(actualString.toString().getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1); + HPacket temp = new HPacket(0); + temp.appendString(latin, StandardCharsets.ISO_8859_1); packet = packet.substring(0, start) + - toString(new HPacket(0, latin).readBytes(latin.length() + 2, 6)) + + toString(temp.readBytes(latin.length() + 2, 6)) + packet.substring(end + 2); } @@ -253,6 +256,9 @@ public class PacketStringUtils { new HPacket("{l}{h:5}{s:\"asdas\"}"), "s" )); + + HPacket p3 = fromString("{l}{h:2266}{s:\"¥\"}{i:0}{i:0}"); + System.out.println(p3); } }