BytesToUnicode.java (getDefaultDecoder): Let default decoder use iconv.

* gnu/gcj/convert/BytesToUnicode.java (getDefaultDecoder): Let
	default decoder use iconv.
	* gnu/gcj/convert/UnicodeToBytes.java (getDefaultEncoder):
	Let default encoder use iconv.
	* configure: Rebuilt.
	* configure.in: Check for nl_langinfo and <langinfo.h>.
	* java/lang/natSystem.cc (file_encoding): New function.
	(DEFAULT_FILE_ENCODING): Define to file_encoding() if possible.

From-SVN: r36306
This commit is contained in:
Tom Tromey 2000-09-11 00:35:51 +00:00 committed by Tom Tromey
parent 56cb97339b
commit fe5e3b9714
7 changed files with 357 additions and 238 deletions

View File

@ -1,3 +1,14 @@
2000-09-08 Tom Tromey <tromey@cygnus.com>
* gnu/gcj/convert/BytesToUnicode.java (getDefaultDecoder): Let
default decoder use iconv.
* gnu/gcj/convert/UnicodeToBytes.java (getDefaultEncoder):
Let default encoder use iconv.
* configure: Rebuilt.
* configure.in: Check for nl_langinfo and <langinfo.h>.
* java/lang/natSystem.cc (file_encoding): New function.
(DEFAULT_FILE_ENCODING): Define to file_encoding() if possible.
2000-09-10 Alexandre Oliva <aoliva@redhat.com>
* acinclude.m4: Simplify the tests for CC and CXX.

534
libjava/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -396,7 +396,8 @@ if test -n "${with_cross_host}"; then
else
AC_CHECK_FUNCS(strerror ioctl select fstat open fsync sleep)
AC_CHECK_FUNCS(gmtime_r localtime_r readdir_r getpwuid_r getcwd)
AC_CHECK_FUNCS(access stat mkdir rename rmdir unlink realpath iconv)
AC_CHECK_FUNCS(access stat mkdir rename rmdir unlink realpath)
AC_CHECK_FUNCS(iconv nl_langinfo)
AC_CHECK_FUNCS(inet_aton inet_addr, break)
AC_CHECK_FUNCS(inet_pton uname inet_ntoa)
AC_CHECK_FUNCS(backtrace fork execvp pipe)
@ -665,7 +666,7 @@ CFLAGS="$save_CFLAGS"
dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
dnl On that system, sys/ioctl.h will not include sys/filio.h unless
dnl BSD_COMP is defined; just including sys/filio.h is simpler.
AC_CHECK_HEADERS(unistd.h bstring.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/filio.h sys/stat.h sys/select.h sys/socket.h netinet/in.h arpa/inet.h netdb.h pwd.h sys/config.h inttypes.h stdint.h)
AC_CHECK_HEADERS(unistd.h bstring.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/filio.h sys/stat.h sys/select.h sys/socket.h netinet/in.h arpa/inet.h netdb.h pwd.h sys/config.h inttypes.h stdint.h langinfo.h)
dnl We avoid AC_HEADER_DIRENT since we really only care about dirent.h
dnl for now. If you change this, you also must update natFile.cc.
AC_CHECK_HEADERS(dirent.h)

View File

@ -52,7 +52,14 @@ public abstract class BytesToUnicode extends IOConverter
}
catch (Throwable ex)
{
return new Input_8859_1();
try
{
return new Input_iconv (System.getProperty ("file.encoding"));
}
catch (Throwable ex2)
{
return new Input_8859_1();
}
}
}

View File

@ -50,7 +50,14 @@ public abstract class UnicodeToBytes extends IOConverter
}
catch (Throwable ex)
{
return new Output_8859_1();
try
{
return new Output_iconv (System.getProperty ("file.encoding"));
}
catch (Throwable ex2)
{
return new Output_8859_1();
}
}
}

View File

@ -230,6 +230,9 @@
/* Define if you have the mkdir function. */
#undef HAVE_MKDIR
/* Define if you have the nl_langinfo function. */
#undef HAVE_NL_LANGINFO
/* Define if you have the open function. */
#undef HAVE_OPEN
@ -299,6 +302,9 @@
/* Define if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have the <langinfo.h> header file. */
#undef HAVE_LANGINFO_H
/* Define if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H

View File

@ -24,6 +24,10 @@ details. */
#include <sys/utsname.h>
#endif
#ifdef HAVE_LANGINFO_H
#include <langinfo.h>
#endif
#include <gcj/cni.h>
#include <jvm.h>
#include <java-props.h>
@ -151,9 +155,26 @@ java::lang::System::identityHashCode (jobject obj)
return _Jv_HashCode (obj);
}
#if ! defined (DEFAULT_FILE_ENCODING) && defined (HAVE_ICONV) \
&& defined (HAVE_NL_LANGINFO)
static char *
file_encoding ()
{
setlocale (LC_CTYPE, "");
char *e = nl_langinfo (CODESET);
if (e == NULL || *e == '\0')
e = "8859_1";
}
#define DEFAULT_FILE_ENCODING file_encoding ()
#endif
#ifndef DEFAULT_FILE_ENCODING
#define DEFAULT_FILE_ENCODING "8859_1"
#endif
static char *default_file_encoding = DEFAULT_FILE_ENCODING;
#if HAVE_GETPWUID_R