I have a system, where I got French Text from third party, but I am facing hard time to get it readable.
String frenchReceipt = "RETIR�E"; // The original Text should be "RETIRÉE"
I tried all possible combinations to convert the string using encoding of UTF-8 and ISO-8859-1
String frenchReceipt = "RETIR�E"; // The original Text should be "RETIRÉE"
byte[] b1 = new String(frenchReceipt.getBytes()).getBytes("UTF-8");
System.out.println(new String(b1)); // RETIR�E
byte[] b2 = new String(frenchReceipt.getBytes()).getBytes("ISO-8859-1");
System.out.println(new String(b2)); // RETIR�E
byte[] b3 = new String(frenchReceipt.getBytes(), "UTF-8").getBytes();
System.out.println(new String(b3)); // RETIR?E
byte[] b4 = new String(frenchReceipt.getBytes(), "UTF-8").getBytes();
System.out.println(new String(b4)); //RETIR?E
byte[] b5 = new String(frenchReceipt.getBytes(), "ISO-8859-1").getBytes("UTF-8");
System.out.println(new String(b5)); //RETIR�E
byte[] b6 = new String(frenchReceipt.getBytes(), "UTF-8").getBytes("ISO-8859-1");
System.out.println(new String(b6)); //RETIR?E
byte[] b7 = new String(frenchReceipt.getBytes(), "UTF-8").getBytes("UTF-8");
System.out.println(new String(b7)); //RETIR�E
byte[] b8 = new String(frenchReceipt.getBytes(), "ISO-8859-1").getBytes("ISO-8859-1");
System.out.println(new String(b8)); //RETIR�E
As you see nothing fix the problem.
Please advise.
Update: The third -party partner confirmed that data sent to my application in "ISO-8859-1" Encoding