This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: GCJ and Sun going GPL (again)
- From: Chris Burdess <dog at bluezoo dot org>
- To: fernando at lozano dot eti dot br
- Cc: Marco Trudel <mtrudel at gmx dot ch>, GCJ <java at gcc dot gnu dot org>
- Date: Wed, 6 Dec 2006 10:17:15 +0000
- Subject: Re: GCJ and Sun going GPL (again)
- References: <4575bf81.360.29b3.874041887@lozano.eti.br>
fernando@lozano.eti.br wrote:
> Well, Me and all Java developers I have worked with type non-ASCII characters in Java source files,
> and also in C, PHP, Perl, Python and other source files. I can't see why this should not be safe,
> and if I remember correctly it's explicitly supported by the Java language specification.
It is not safe because it requires others to guess what encoding you
were using to author your file. If they guess wrong, then they may
compile the wrong strings, strings that you didn't intend, into their
program.
Suppose you have written
String zagolovok = "ÐÐÑÐÐÐÐÐÐÐ ÑÐÐÑ ÐÑÑÑÐÑÐÐÐÐÐÐÐ";
in iso-8859-5 (quite natural, for Russian). Then someone comes along and
tries to compile your source file, but their locale is set to use
iso-8859-1 as an encoding. Remember, they're just compiling your
program. They probably never even looked at the contents of the source
file. So what they compile is
String zagolovok = "ÂÃÃÃÃÃÃÃÃÃ ÃÃÃÃ ÃÃÃÃÃÃÃÃÃÃÃÃÃ";
This is a fundamental problem with the specification of Java language
source files, and inexperienced Java developers often get bitten by it.
--
Chris Burdess