Closed XePeleato closed 3 years ago
does it work like this as well?
My tests confirm it does, however the predictors seem to break sometimes
System.out.println(new HPacket(10, 2, 100000, "Dragón de Fuego Azul", 3).toExpression());
System.out.println(new HPacket(10, 2, 100000, "Dragon de Fuego Azul", 3).toExpression());
System.out.println(new HPacket(10, 2, 100000, "Dragón", 3).toExpression());
System.out.println(new HPacket(10, 2, 100000, "Dragon", 3).toExpression());
System.out.println("\n\n");
System.out.println(new HPacket("{l}{h:10}{i:2}{i:100000}{s:\"Dragón de Fuego Azul\"}{i:3}").toExpression());
System.out.println(new HPacket("{l}{h:10}{i:2}{i:100000}{s:\"Dragon de Fuego Azul\"}{i:3}").toExpression());
System.out.println(new HPacket("{l}{h:10}{i:2}{i:100000}{s:\"Dragón\"}{i:3}").toExpression());
System.out.println(new HPacket("{l}{h:10}{i:2}{i:100000}{s:\"Dragon\"}{i:3}").toExpression());
return
{l}{h:10}{i:2}{i:100000}{s:"Dragón de Fuego Azul"}{i:3}
{l}{h:10}{i:2}{i:100000}{s:"Dragon de Fuego Azul"}{i:3}
{l}{h:10}{i:2}{i:100000}{b:false}{i:121926241}{i:1740878702}{i:3}
{l}{h:10}{i:2}{i:100000}{s:"Dragon"}{i:3}
{l}{h:10}{i:2}{i:100000}{b:false}{i:390361697}{i:1740866498}{i:-1284628380}{b:101}{b:32}{i:1182098791}{i:1864384890}{i:3}
{l}{h:10}{i:2}{i:100000}{s:"Dragon de Fuego Azul"}{i:3}
{l}{h:10}{i:2}{i:100000}{b:false}{i:155480673}{i:1740866498}{i:3}
{l}{h:10}{i:2}{i:100000}{s:"Dragon"}{i:3}
was this the case in the original PR commit as well?
was this the case in the original PR commit as well?
Yes, that happened with my code too
will fix the utf structure thing later
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.