I'm having trouble discovering the encoding of a string.
The entry is:
São Paulo
The original reading of this content is not for me, because the text goes through a wrapper from Lua to Java.
On my side, I already tried the following "brute force" and I do not think the conversion is correct:
byte[] bytes1 = entrada.getBytes();
System.out.println(Arrays.toString(bytes1));
System.out.println(new String(bytes1));
System.out.println(new String(bytes1, StandardCharsets.UTF_8));
System.out.println(new String(bytes1, StandardCharsets.ISO_8859_1));
System.out.println(new String(bytes1, StandardCharsets.US_ASCII));
byte[] bytes2 = entrada.getBytes(StandardCharsets.UTF_8);
System.out.println(Arrays.toString(bytes2));
System.out.println(new String(bytes2));
System.out.println(new String(bytes2, StandardCharsets.UTF_8));
System.out.println(new String(bytes2, StandardCharsets.ISO_8859_1));
System.out.println(new String(bytes2, StandardCharsets.US_ASCII));
byte[] bytes3 = entrada.getBytes(StandardCharsets.ISO_8859_1);
System.out.println(Arrays.toString(bytes3));
System.out.println(new String(bytes3));
System.out.println(new String(bytes3, StandardCharsets.UTF_8));
System.out.println(new String(bytes3, StandardCharsets.ISO_8859_1));
System.out.println(new String(bytes3, StandardCharsets.US_ASCII));
byte[] bytes4 = entrada.getBytes(StandardCharsets.US_ASCII);
System.out.println(Arrays.toString(bytes4));
System.out.println(new String(bytes4));
System.out.println(new String(bytes4, StandardCharsets.UTF_8));
System.out.println(new String(bytes4, StandardCharsets.ISO_8859_1));
System.out.println(new String(bytes4, StandardCharsets.US_ASCII));
And I have the following output, all wrong:
[83, -29, -81, -96, 80, 97, 117, 108, 111]
S㯠Paulo
S㯠Paulo
S㯠Paulo
S���Paulo
[83, -29, -81, -96, 80, 97, 117, 108, 111]
S㯠Paulo
S㯠Paulo
S㯠Paulo
S���Paulo
[83, 63, 80, 97, 117, 108, 111]
S?Paulo
S?Paulo
S?Paulo
S?Paulo
[83, 63, 80, 97, 117, 108, 111]
S?Paulo
S?Paulo
S?Paulo
S?Paulo
Can anyone help me? Thank you in advance.