This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: A few tips
- From: Jim White <jim at pagesmiths dot com>
- To: Per Bothner <per at bothner dot com>
- Cc: Dominique Boucher <dboucher at nuecho dot com>, 'Kawa List' <kawa at sources dot redhat dot com>
- Date: Mon, 10 Nov 2003 01:59:04 -0800
- Subject: Re: A few tips
- References: <000501c39f55$a8ce8850$6400a8c0@Forman> <3FAF1852.90405@bothner.com>
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