Commit fe5e3b97 by Tom Tromey Committed by Tom Tromey

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
parent 56cb9733
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> 2000-09-10 Alexandre Oliva <aoliva@redhat.com>
* acinclude.m4: Simplify the tests for CC and CXX. * acinclude.m4: Simplify the tests for CC and CXX.
......
...@@ -396,7 +396,8 @@ if test -n "${with_cross_host}"; then ...@@ -396,7 +396,8 @@ if test -n "${with_cross_host}"; then
else else
AC_CHECK_FUNCS(strerror ioctl select fstat open fsync sleep) 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(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_aton inet_addr, break)
AC_CHECK_FUNCS(inet_pton uname inet_ntoa) AC_CHECK_FUNCS(inet_pton uname inet_ntoa)
AC_CHECK_FUNCS(backtrace fork execvp pipe) AC_CHECK_FUNCS(backtrace fork execvp pipe)
...@@ -665,7 +666,7 @@ CFLAGS="$save_CFLAGS" ...@@ -665,7 +666,7 @@ CFLAGS="$save_CFLAGS"
dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there. 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 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. 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 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. dnl for now. If you change this, you also must update natFile.cc.
AC_CHECK_HEADERS(dirent.h) AC_CHECK_HEADERS(dirent.h)
......
...@@ -52,7 +52,14 @@ public abstract class BytesToUnicode extends IOConverter ...@@ -52,7 +52,14 @@ public abstract class BytesToUnicode extends IOConverter
} }
catch (Throwable ex) 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();
}
} }
} }
......
...@@ -50,7 +50,14 @@ public abstract class UnicodeToBytes extends IOConverter ...@@ -50,7 +50,14 @@ public abstract class UnicodeToBytes extends IOConverter
} }
catch (Throwable ex) 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();
}
} }
} }
......
...@@ -230,6 +230,9 @@ ...@@ -230,6 +230,9 @@
/* Define if you have the mkdir function. */ /* Define if you have the mkdir function. */
#undef HAVE_MKDIR #undef HAVE_MKDIR
/* Define if you have the nl_langinfo function. */
#undef HAVE_NL_LANGINFO
/* Define if you have the open function. */ /* Define if you have the open function. */
#undef HAVE_OPEN #undef HAVE_OPEN
...@@ -299,6 +302,9 @@ ...@@ -299,6 +302,9 @@
/* Define if you have the <inttypes.h> header file. */ /* Define if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H #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. */ /* Define if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H #undef HAVE_NETDB_H
......
...@@ -24,6 +24,10 @@ details. */ ...@@ -24,6 +24,10 @@ details. */
#include <sys/utsname.h> #include <sys/utsname.h>
#endif #endif
#ifdef HAVE_LANGINFO_H
#include <langinfo.h>
#endif
#include <gcj/cni.h> #include <gcj/cni.h>
#include <jvm.h> #include <jvm.h>
#include <java-props.h> #include <java-props.h>
...@@ -151,9 +155,26 @@ java::lang::System::identityHashCode (jobject obj) ...@@ -151,9 +155,26 @@ java::lang::System::identityHashCode (jobject obj)
return _Jv_HashCode (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 #ifndef DEFAULT_FILE_ENCODING
#define DEFAULT_FILE_ENCODING "8859_1" #define DEFAULT_FILE_ENCODING "8859_1"
#endif #endif
static char *default_file_encoding = DEFAULT_FILE_ENCODING; static char *default_file_encoding = DEFAULT_FILE_ENCODING;
#if HAVE_GETPWUID_R #if HAVE_GETPWUID_R
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment