Method:
public static void test() throws IOException { String input = "ABCÉÔpqr"; // charsetName = ISO-8859-1 String utf8String = new String(StandardCharsets.UTF_8.encode(input).array()); }
Required Output:
Output : "ABCÉÔpqr" Encoding : UTF-8
I wanted to convert String "ABCÉÔpqr"
into its UTF-8 encoding without loosing its representation.
Current Output:
Output : "ABC��pqr"