Change Tomcat's Charset.defaultCharset in windows

前端 未结 4 533
梦毁少年i
梦毁少年i 2020-12-03 03:06

I\'m using tomcat 6.0.32 in windows 7. Inside a very simple servlet, inside the init method, I\'m printing:

System.out.println(Charset.defaultCharset());
         


        
4条回答
  •  攒了一身酷
    2020-12-03 04:09

    For Tomcat running as a Windows service neither %JAVA_OPTS% and neither setenv.bat answers works in my case.

    I set the option "-Dfile.encoding=UTF8" in registry:

    "HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Procrun 2.0\tomcatstackTomcat\Parameters\Java --> Options*

    Then it works.

提交回复
热议问题