What does -Dfile.encoding = UTF-8 in JAVA_OPTIONS do

Any idea what does -Dfile.encoding = UTF-8 in

JAVA_OPTIONS="${JAVA_OPTIONS} -Dfile.encoding=UTF-8"

      

do? I have this setting in my jetty server config.

If I don't have this, what could be the consequence?

+3


source to share


1 answer


It sets a property that determines in which encoding to save and read files by default. It must be installed when the JVM starts.

There are several encodings - the ways in which characters are represented on computers. UTF-8 is one of the best to use as it contains all the special characters in many languages.



Once you don't have this property, Java can save files in a different encoding, which can lead to strange characters when you open the file with a text editor. You can avoid this problem by manually setting the desired encoding on OutputStream

s.

+2


source







All Articles