5

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

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

do? I have this option in my jetty server configuration.

If i dont have it, what might be consequence?

xenteros
  • 15,586
  • 12
  • 56
  • 91
Nilotpal
  • 3,237
  • 4
  • 34
  • 56
  • Possible duplicate of [Jetty response character encoding](https://stackoverflow.com/questions/31804805/jetty-response-character-encoding) – Betlista Jul 26 '17 at 07:24

1 Answers1

3

It sets a property which defines in which encoding will Java save and read files by default. It must be set at JVM startup.

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

Once you don't have this property, Java might save files in a different encoding which might lead to strange characters when opening the file with text editor. You can avoid this issue by manually setting the desired encoding to your OutputStreams.

xenteros
  • 15,586
  • 12
  • 56
  • 91