What is the purpose of the system property sun.jnu.encoding
? Various fragments on the web set or report it, but I can't find a definition.
问题:
回答1:
see http://happygiraffe.net/blog/2009/09/24/java-platform-encoding/
This link describes the usage of the sun.jnu.encoding
property for using the correct encoding when parsing values passed via the commandline, something that setting the file.encoding
property doesn't influence.
回答2:
I did some investigation on encoding and as per my analysis
- sun.jnu.encoding affects the creation of file name (this possibly gets set by LANG on unix before starting java)
- file.encoding affects the content of a file
回答3:
I believe that this value represents the system encoding, which may be different from the user encoding ("file.encoding") on some platforms. The "sun" prefix makes me suspect that this is an implementation detail specific to the Sun JRE (a quick look at an IBM 1.4 VM shows an "ibm.system.encoding" system property). I have no idea on how this might be used internally - though I'm sure a quick look through the source would yield some clues.