Why is ¿ displayed different in Windows vs Linux even when using UTF-8?

后端 未结 5 477
小鲜肉
小鲜肉 2021-01-14 20:49

Why is the following displayed different in Linux vs Windows?

System.out.println(new String(\"¿\".getBytes(\"UTF-8\"), \"UTF-8\"));

in Wind

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-14 21:15

    Check what encoding your linux terminal has.

    For gnome-terminal in ubuntu - go to the "Terminal" menu and select "Set Character Encoding".

    For putty, Configuration -> Window -> Translation -> UTF-8 (and if that doesn't work, see this post).

提交回复
热议问题