3
In my case I used so:
System.setProperty("file.encoding", "UTF-8");
It would be the identification of the language used?
3
In my case I used so:
System.setProperty("file.encoding", "UTF-8");
It would be the identification of the language used?
3
When you run a program you "start" a JVM instance and this instance has its own environment variables, some properties being initialized natively (native method initProperties
). In the implementation of System
you notice that there is a static variable of Properties
, which is the object that contains all system properties and is accessible by any application/library running on the instance of JVM
.
Of the documentation of System.setProperty
Sets the system Property indicated by the specified key.
That is, this method creates or changes the value of a system property that is shared by all applications/libraries running on the same instance of JVM
.
In your case you are redefining the encoding (encoding) default to be used by applications/libraries running in the same instance you are running your application.
Just as a curiosity about coding in the JVM, there are three encodings "pattern":
file.encoding
: System.getProperty("file.encoding")
;
java.nio.charset.Charset
: Charset.defaultCharset()
. This, at the initialization of the encoding standard, use the property file.encoding
and if it does not exist, it adopts UTF-8
;
and the encoding of InputStreamReader
: InputStreamReader.getEncoding()
.
Browser other questions tagged java android
You are not signed in. Login or sign up in order to post.