From fe5e3b9714a2ef529f5d514dab61747137c89527 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 11 Sep 2000 00:35:51 +0000 Subject: 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 . * java/lang/natSystem.cc (file_encoding): New function. (DEFAULT_FILE_ENCODING): Define to file_encoding() if possible. From-SVN: r36306 --- libjava/java/lang/natSystem.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'libjava/java/lang') diff --git a/libjava/java/lang/natSystem.cc b/libjava/java/lang/natSystem.cc index 1ea29b3..ca75430 100644 --- a/libjava/java/lang/natSystem.cc +++ b/libjava/java/lang/natSystem.cc @@ -24,6 +24,10 @@ details. */ #include #endif +#ifdef HAVE_LANGINFO_H +#include +#endif + #include #include #include @@ -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 -- cgit v1.1