I have already tried convert byte cp1252
to byte utf8
but all is in vain.
For example: I have byte[] 0xB5(cp1252)
and I want convert to byte[] 0xC3, 0xA0(utf8)
.
I want to like this: µ --> à.
My code but it is not working:
public void convert(){
try {
byte[] cp1252 = new byte[]{(byte) 0xB5};
byte[] utf8= new String(cp1252, "CP-1252").getBytes("UTF-8");
// values of utf8 array are 0xC2, 0xB5 not 0xC3, 0XA0 as I expected
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
}