Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Java determine 'file.encoding' system property?

I thought Java determines 'file.encoding' system property by system locale.

But in my system while system locale is 'ko_kr.UTF-8', 'file.encoding' is 'ANSI_X3.4-1968'.

How does Java determine 'file.encoding' system property?

like image 326
Johnny Lim Avatar asked Sep 04 '12 05:09

Johnny Lim


People also ask

What encoding does Java use?

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.

How do I know the encoding of a file?

Files generally indicate their encoding with a file header. There are many examples here. However, even reading the header you can never be sure what encoding a file is really using. For example, a file with the first three bytes 0xEF,0xBB,0xBF is probably a UTF-8 encoded file.

Does Java use UTF-8?

Java supports a wide array of encodings and their conversions to each other. The class Charset defines a set of standard encodings which every implementation of Java platform is mandated to support. This includes US-ASCII, ISO-8859-1, UTF-8, and UTF-16 to name a few.


1 Answers

Native code populating properties from the below link(for solaris,Linux operating system )

Below native method loading system properties.

private static native Properties initProperties(Properties props);

Below link is the native code link for loading properties( after line number 187)

Source for setting java properties

like image 118
sreemanth pulagam Avatar answered Oct 31 '22 19:10

sreemanth pulagam