My UTF-8 strings have been converted to ISO-8859-1 strings in the following way:
Is there a way to undo this conversion, so that
é for example?
Suppose we have a string containing double iso-8859-1 characters, such as
To convert double iso-8859-1 to UTF-8 characters, we can use this constructor of
String. Pass an array of
byte and a
CharSet object. The class
java.nio.charset.StandardCharsets provides constants for various
String accentE = new String( "Ã©".getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8 ) ;
See this code run live at IdeOne.com.