I have a string that might contain Latin symbols and / or letters.
How do I take that String and convert it to UTF-8 encoded String?
For example if my String is:
"óóó"
I wish to convert it to be:
"óóó"
I have a string that might contain Latin symbols and / or letters.
How do I take that String and convert it to UTF-8 encoded String?
For example if my String is:
"óóó"
I wish to convert it to be:
"óóó"
public static void main(String [] args) {
String input = "ÁÉÍÓÚÜÑáéíóúüñ¡¿";
//simulate ISO_8859 input
ByteBuffer iso = StandardCharsets.ISO_8859_1.encode(input);
CharBuffer buffer = StandardCharsets.ISO_8859_1.decode(iso);
ByteBuffer byteBuffer = StandardCharsets.UTF_8.encode(buffer);
System.out.println(new String(byteBuffer.array()));
}