Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Change default character set of JVM  RSS feed

 
Kelvin Yong
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to change the default character set of JVM to say, UTF-8?



On Windows
==========
Default Character Set: Cp1252
File Encoding: Cp1252

On Linux
========
Default Character Set: ASCII
File Encoding: ANSI_X3.4-1968


I would like to save on the effort of changing the many lines of code that looks like

to

Thanks,
Kelvin
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, I don't believe this is possible. It may be possible to change the regional settings in your OS instead - however I don't see a way to set it to UTF-8 on Windows. (I only checked quickly; I may have missed something.)

I would recommend that you go ahead and replace your code with calls to a custom method like this:

This will make it much easier to make such changes in the future. As well as shortening up your code.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!