From Oracle’s Supported Encodings Documentation :
You have to use
x-windows-iso2022jp
encoding charset. It is a Variant ISO-2022-JP (MS932 based)
Try this code out :
public class App {
public static void main(String[] args) {
final String z = "髙";
final Charset charset = Charset.forName("x-windows-iso2022jp");
final byte[] byteArr = z.getBytes(charset);
final String z2 = new String(byteArr, charset);
System.out.println(z);
System.out.println(z2);
}
}
Console Output on AdoptedOpenJDK 11:
CLICK HERE to find out more related problems solutions.