File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Best practise for setting character encoding

 
Luke Murphy
Ranch Hand
Posts: 300
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
We always want UTF-8.
Is it better to set this as a system property passed to the JVM e.g.
-Dfile.encoding=UTF-8

Or is it better to set it programmatically:

System.setProperty("file.encoding", "UTF-8");

And why?

Thanks.

 
Eduardo YaƱez Parareda
Ranch Hand
Posts: 93
IntelliJ IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on your enviroment, I prefer to have it in a configuration file, then set it programmatically. That way you don't depend on Server Applications Admins, and it isn't hardcoded.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic