This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: A few tips


Per Bothner wrote:

> Does anyone know how one finds out in Java what the default (system)
> encoding is?

InputStreamReader/OutputStreamWriter.getEncoding() will return the stream's encoding, which will be the default if constructed w/o an encoding name.

http://java.sun.com/j2se/1.3/docs/api/java/lang/package-summary.html#charenc

The actual method used to determine the default is JRE/platform specific of course.

The Sun JRE has a 'file.encoding' property which doesn't seem to be documented although its function is obvious.

http://java.sun.com/j2se/1.3/docs/api/java/lang/System.html#getProperties()

The Sun java command does support the relevant platform-specific environment method for specifying the default file encoding, although I don't know where that is documented (although I seem to have seen it somewhere when I went through this jazz before). As you note, on Un*x (POSIX) the LANG (or LC_ALL) environment variable does the job.

http://publib16.boulder.ibm.com/pseries/en_US/aixprggd/nlsgdrf/locale_env.htm

Jim
--
"I love deadlines. I love the whooshing sound they make as they fly by." -- Douglas Adams



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]