aspose file tools
The moose likes Java in General and the fly likes Best practise for setting character encoding Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Best practise for setting character encoding" Watch "Best practise for setting character encoding" New topic
Author

Best practise for setting character encoding

Luke Murphy
Ranch Hand

Joined: May 12, 2010
Posts: 299
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

Joined: Oct 09, 2008
Posts: 92

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.


http://serfj.sourceforge.net - Simplest Ever REST Framework for Java
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Best practise for setting character encoding
 
Similar Threads
Displaying Japanese characters in JSP
problem with Euro symbol
JSP Page Encoding
Trying to print XML using a servlet
Foreign characters not preserved