* lex.c (java_new_lexer): Set 'encoding'.
(java_read_char): Improve error message for unrecognized characters.
* lex.h (struct java_lexer): New field 'encoding'.
From-SVN: r82292
+2004-05-26 Bryce McKinlay <mckinlay@redhat.com>
+
+ * lex.c (java_new_lexer): Set 'encoding'.
+ (java_read_char): Improve error message for unrecognized characters.
+ * lex.h (struct java_lexer): New field 'encoding'.
+
2004-05-23 Paolo Bonzini <bonzini@gnu.org>
* Make-lang.in: Link in $(LIBCPP) instead of mkdeps.o.
lex->bs_count = 0;
lex->unget_value = 0;
lex->hit_eof = 0;
+ lex->encoding = encoding;
#ifdef HAVE_ICONV
lex->handle = iconv_open ("UCS-2", encoding);
enc_error = 1;
#ifdef HAVE_ICONV
else
- lex->use_fallback = 1;
+ {
+ lex->use_fallback = 1;
+ lex->encoding = "UTF-8";
+ }
#endif /* HAVE_ICONV */
}
else
{
/* A more serious error. */
- java_lex_error ("unrecognized character in input stream",
- 0);
+ char buffer[128];
+ sprintf (buffer,
+ "Unrecognized character for encoding '%s'",
+ lex->encoding);
+ java_lex_error (buffer, 0);
return UEOF;
}
}
/* If nonzero, we've hit EOF. Used only by java_get_unicode(). */
int hit_eof : 1;
+
+ /* Name of the character encoding we're using. */
+ const char *encoding;
#ifdef HAVE_ICONV
/* Nonzero if we've read any bytes. We only recognize the