Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JVM property -Dfile.encoding=UTF8 or UTF-8?

I would like to know what is the value of the Java Virtual Machine (JVM) property to set my file encoding to UTF-8.

Do I put -Dfile.encoding=UTF8 or -Dfile.encoding=UTF-8?

like image 250
astrotouf Avatar asked May 17 '11 13:05

astrotouf


People also ask

Does Java use UTF-8 or UTF-16?

The native character encoding of the Java programming language is UTF-16. A charset in the Java platform therefore defines a mapping between sequences of sixteen-bit UTF-16 code units (that is, sequences of chars) and sequences of bytes.

Should I use UTF-8 or ASCII?

UTF-8 is but a single encoding of that standard, there are many more. UTF-16 being the most widely used as it is the native encoding for Windows. So, if you need to support anything beyond the 128 characters of the ASCII set, my advice is to go with UTF-8.

Why UTF-8 is used in Java?

UTF-8 has the ability to be as condensed as ASCII but can also contain any Unicode characters with some increase in the size of the file. UTF stands for Unicode Transformation Format. The '8' signifies that it allocates 8-bit blocks to denote a character.

Is it more efficient to use ASCII or UTF-8 as an encoding?

There's no difference between ASCII and UTF-8 when storing digits. A tighter packing would be using 4 bits per digit (BCD). If you want to go below that, you need to take advantage of the fact that long sequences of 10-base values can be presented as 2-base (binary) values. Save this answer.


1 Answers

It will be:

UTF8 

See here for the definitions.

like image 96
planetjones Avatar answered Sep 20 '22 17:09

planetjones