Is there a way to change the encoding used by the String(byte[]) constructor ?
In my own code I use String(byte[],String) to specify the encoding but I am using an external library that I cannot change.
String src = "with accents: é à";
byte[] bytes = src.getBytes("UTF-8");
System.out.println("UTF-8 decoded: "+new String(bytes,"UTF-8"));
System.out.println("Default decoded: "+new String(bytes));
The output for this is :
UTF-8 decoded: with accents: é à Default decoded: with accents: é Ã
I have tried changing the system property file.encoding
but it does not work.