syntax errors in comments?

Tom Tromey
Tue Apr 15 19:57:00 GMT 2003

>>>>> "Joe" == Joe Reid <> writes:

Joe> I'm getting a ton of "malformed UTF-8 character." errors compiling my
Joe> code.  Once I started digging in I realized all these errors were
Joe> things like copyright signs and at (@) signs in comments...all in
Joe> comments.  If I can't put an @ sign in my comments how can I build
Joe> javadocs?  Why is the compiler even reading the comments?

This should be a FAQ.

You are telling gcj (perhaps by default) that your file is UTF-8
encoded.  However, it is not.  Most likely, instead, is that it is
Latin-1 encoded.  gcj will die if it encounters what it believes to be
a character encoding error in an input file.

Try `gcj --encoding=ISO-8859-1'.

Whether or not this works is dependent on your OS and on how gcj was
built.  Ordinarily gcj just uses the system iconv() implementation.
On some platforms, the system iconv really isn't very complete, so
this might fail.  You can also build gcj using Bruno Haible's
libiconv, which lets you work around deficiencies in your OS's iconv

I think in the past we've had some problems here with Solaris.  I'm
not sure of the current status.  I mention this because by default gcj
tries to use the encoding from your locale; if it is using UTF-8 can
mean that the iconv support simply wasn't included at all.  In this
situation you'll either have to rebuild gcj with libiconv, or you'll
have to recode your files (see GNU recode, or the iconv command).

I think some fixes in this area will appear in 3.3.  It's hard to
remember; you'd have to check the ChangeLog.


More information about the Java mailing list