Summary:
Default encoding for 1.Java
Content:
Default encoding for 1.Java
The Defaultcharset () method in the Java.nio.charset.Charset class in the Java Src.zip package illustrates that the encoding type of Java is determined by the file.encoding parameters of the JVM, and if the default is not specified UTF-8
/**
* Returns The default charset of this Java virtual machine.
*
* <p> The default charset is determined during Virtual-machine startup and
* Typically depends upon the locale and charset of the underlying
* Operating system.
*
* @return A CharSet object for the default charset
*
* @since 1.5
*/
Public static Charset Defaultcharset () {
if (Defaultcharset = = null) {
synchronized (charset.class) {
String CSN = accesscontroller.doprivileged (
new Getpropertyaction ("file.encoding"));
Charset cs = lookup (CSN);
if (cs! = null)
Defaultcharset = CS;
Else
Defaultcharset = forname ("UTF-8");
}
}
return defaultcharset;
}
Default encoding for Java