Setting the default Java character encoding

后端 未结 17 1773
终归单人心
终归单人心 2020-11-21 06:09

How do I properly set the default character encoding used by the JVM (1.5.x) programmatically?

I have read that -Dfile.encoding=whatever used to be the

17条回答
  •  面向向阳花
    2020-11-21 06:49

    I have tried a lot of things, but the sample code here works perfect. Link

    The crux of the code is:

    String s = "एक गाव में एक किसान";
    String out = new String(s.getBytes("UTF-8"), "ISO-8859-1");
    

提交回复
热议问题