This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch: FYI: gcj lex and `646' encoding
- From: Tom Tromey <tromey at redhat dot com>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Cc: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 29 Mar 2002 12:31:17 -0700
- Subject: Patch: FYI: gcj lex and `646' encoding
- Reply-to: tromey at redhat dot com
I'm checking this in on the trunk and the 3.1 branch.
This is a little hackish, but our experience has been that Solaris is
really the iconv problem child. Other platforms either don't have
iconv or have a fully-functional iconv. Adding this patch will almost
certainly decrease the number of "RTFM" messages we have to send out
about this problem.
Tom
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/ChangeLog,v
retrieving revision 1.925.2.30
diff -u -r1.925.2.30 ChangeLog
--- ChangeLog 2002/03/29 00:41:15 1.925.2.30
+++ ChangeLog 2002/03/29 19:28:26
@@ -1,3 +1,7 @@
+2002-03-29 Martin Kahlert <martin.kahlert@infineon.com>
+
+ * lex.c (java_new_lexer): Alias "646" to DEFAULT_ENCODING.
+
2002-03-28 Tom Tromey <tromey@redhat.com>
* except.c (expand_end_java_handler): If the handler type is NULL,
Index: lex.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/lex.c,v
retrieving revision 1.80.8.3
diff -u -r1.80.8.3 lex.c
--- lex.c 2002/03/22 23:59:20 1.80.8.3
+++ lex.c 2002/03/29 19:28:30
@@ -290,8 +290,13 @@
/* If iconv failed, use the internal decoder if the default
encoding was requested. This code is used on platforms where
iconv exists but is insufficient for our needs. For
- instance, on Solaris 2.5 iconv cannot handle UTF-8 or UCS-2. */
- if (strcmp (encoding, DEFAULT_ENCODING))
+ instance, on Solaris 2.5 iconv cannot handle UTF-8 or UCS-2.
+
+ On Solaris the default encoding, as returned by nl_langinfo(),
+ is `646' (aka ASCII), but the Solaris iconv_open() doesn't
+ understand that. We work around that by pretending
+ `646' to be the same as UTF-8. */
+ if (strcmp (encoding, DEFAULT_ENCODING) && strcmp (encoding, "646"))
enc_error = 1;
#ifdef HAVE_ICONV
else