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);


Console Output on AdoptedOpenJDK 11:

enter image description here

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top