summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2000-05-29 18:48:29 +0000
committerOwen Taylor <otaylor@src.gnome.org>2000-05-29 18:48:29 +0000
commit466305d0ca11da051e6d1be823681fd54c831c08 (patch)
tree7107625f66e72a22e8ab9eb8dd02acea987b3797
parent1fe02b28ad2e689d5d93cf389eeafa3d84f5fea6 (diff)
downloadglib-466305d0ca11da051e6d1be823681fd54c831c08.tar.gz
Add function to get the codeset name for the current locale.
Mon May 29 14:10:35 2000 Owen Taylor <otaylor@redhat.com> * gutils.c (g_locale_get_codeset): Add function to get the codeset name for the current locale. * configure.in acconfig.h: Add check for nl_langinfo(CODESET);
-rw-r--r--ChangeLog7
-rw-r--r--ChangeLog.pre-2-07
-rw-r--r--ChangeLog.pre-2-107
-rw-r--r--ChangeLog.pre-2-127
-rw-r--r--ChangeLog.pre-2-27
-rw-r--r--ChangeLog.pre-2-47
-rw-r--r--ChangeLog.pre-2-67
-rw-r--r--ChangeLog.pre-2-87
-rw-r--r--acconfig.h1
-rw-r--r--configure.in11
-rw-r--r--glib.h2
-rw-r--r--glib/glib.h2
-rw-r--r--glib/gutils.c17
-rw-r--r--gutils.c17
14 files changed, 106 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 79c419aeb..ba5352d57 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Mon May 29 14:10:35 2000 Owen Taylor <otaylor@redhat.com>
+
+ * gutils.c (g_locale_get_codeset): Add function to get the
+ codeset name for the current locale.
+
+ * configure.in acconfig.h: Add check for nl_langinfo(CODESET);
+
Fri May 19 11:39:29 2000 Tim Janik <timj@gtk.org>
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 79c419aeb..ba5352d57 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,10 @@
+Mon May 29 14:10:35 2000 Owen Taylor <otaylor@redhat.com>
+
+ * gutils.c (g_locale_get_codeset): Add function to get the
+ codeset name for the current locale.
+
+ * configure.in acconfig.h: Add check for nl_langinfo(CODESET);
+
Fri May 19 11:39:29 2000 Tim Janik <timj@gtk.org>
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 79c419aeb..ba5352d57 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,10 @@
+Mon May 29 14:10:35 2000 Owen Taylor <otaylor@redhat.com>
+
+ * gutils.c (g_locale_get_codeset): Add function to get the
+ codeset name for the current locale.
+
+ * configure.in acconfig.h: Add check for nl_langinfo(CODESET);
+
Fri May 19 11:39:29 2000 Tim Janik <timj@gtk.org>
diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12
index 79c419aeb..ba5352d57 100644
--- a/ChangeLog.pre-2-12
+++ b/ChangeLog.pre-2-12
@@ -1,3 +1,10 @@
+Mon May 29 14:10:35 2000 Owen Taylor <otaylor@redhat.com>
+
+ * gutils.c (g_locale_get_codeset): Add function to get the
+ codeset name for the current locale.
+
+ * configure.in acconfig.h: Add check for nl_langinfo(CODESET);
+
Fri May 19 11:39:29 2000 Tim Janik <timj@gtk.org>
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 79c419aeb..ba5352d57 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,10 @@
+Mon May 29 14:10:35 2000 Owen Taylor <otaylor@redhat.com>
+
+ * gutils.c (g_locale_get_codeset): Add function to get the
+ codeset name for the current locale.
+
+ * configure.in acconfig.h: Add check for nl_langinfo(CODESET);
+
Fri May 19 11:39:29 2000 Tim Janik <timj@gtk.org>
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 79c419aeb..ba5352d57 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,10 @@
+Mon May 29 14:10:35 2000 Owen Taylor <otaylor@redhat.com>
+
+ * gutils.c (g_locale_get_codeset): Add function to get the
+ codeset name for the current locale.
+
+ * configure.in acconfig.h: Add check for nl_langinfo(CODESET);
+
Fri May 19 11:39:29 2000 Tim Janik <timj@gtk.org>
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 79c419aeb..ba5352d57 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,10 @@
+Mon May 29 14:10:35 2000 Owen Taylor <otaylor@redhat.com>
+
+ * gutils.c (g_locale_get_codeset): Add function to get the
+ codeset name for the current locale.
+
+ * configure.in acconfig.h: Add check for nl_langinfo(CODESET);
+
Fri May 19 11:39:29 2000 Tim Janik <timj@gtk.org>
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 79c419aeb..ba5352d57 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,10 @@
+Mon May 29 14:10:35 2000 Owen Taylor <otaylor@redhat.com>
+
+ * gutils.c (g_locale_get_codeset): Add function to get the
+ codeset name for the current locale.
+
+ * configure.in acconfig.h: Add check for nl_langinfo(CODESET);
+
Fri May 19 11:39:29 2000 Tim Janik <timj@gtk.org>
diff --git a/acconfig.h b/acconfig.h
index 70d0114e1..f79d40031 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -54,6 +54,7 @@
#undef GLIB_BYTE_CONTENTS_GRECMUTEX
#undef HAVE_BROKEN_WCTYPE
+#undef HAVE_CODESET
#undef HAVE_DOPRNT
#undef HAVE_FLOAT_H
#undef HAVE_GETPWUID_R
diff --git a/configure.in b/configure.in
index 2c5af751d..d834e596f 100644
--- a/configure.in
+++ b/configure.in
@@ -449,6 +449,17 @@ AC_CACHE_VAL(glib_cv_sane_realloc,[
])
AC_MSG_RESULT($glib_cv_sane_realloc)
+dnl Check for nl_langinfo and CODESET
+
+AC_MSG_CHECKING([for nl_langinfo (CODESET)])
+AC_TRY_COMPILE([#include <langinfo.h>],
+ [char *codeset = nl_langinfo (CODESET);],
+ AC_DEFINE(HAVE_CODESET)
+ have_codeset=yes,
+ have_codeset=no)
+
+AC_MSG_RESULT($have_codeset)
+
dnl **********************
dnl *** va_copy checks ***
diff --git a/glib.h b/glib.h
index ea31dbb22..d585282b9 100644
--- a/glib.h
+++ b/glib.h
@@ -1712,6 +1712,8 @@ gchar* g_get_current_dir (void);
* must not be freed. */
gchar* g_getenv (const gchar *variable);
+gchar * g_locale_get_codeset (void);
+
/* we use a GLib function as a replacement for ATEXIT, so
* the programmer is not required to check the return value
* (if there is any in the implementation) and doesn't encounter
diff --git a/glib/glib.h b/glib/glib.h
index ea31dbb22..d585282b9 100644
--- a/glib/glib.h
+++ b/glib/glib.h
@@ -1712,6 +1712,8 @@ gchar* g_get_current_dir (void);
* must not be freed. */
gchar* g_getenv (const gchar *variable);
+gchar * g_locale_get_codeset (void);
+
/* we use a GLib function as a replacement for ATEXIT, so
* the programmer is not required to check the return value
* (if there is any in the implementation) and doesn't encounter
diff --git a/glib/gutils.c b/glib/gutils.c
index 09646ccb5..f09715ac2 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -72,6 +72,10 @@
# include <io.h>
#endif /* G_OS_WIN32 */
+#ifdef HAVE_CODESET
+#include <langinfo.h>
+#endif
+
const guint glib_major_version = GLIB_MAJOR_VERSION;
const guint glib_minor_version = GLIB_MINOR_VERSION;
const guint glib_micro_version = GLIB_MICRO_VERSION;
@@ -756,3 +760,16 @@ g_int_hash (gconstpointer v)
{
return *(const gint*) v;
}
+
+gchar *
+g_locale_get_codeset (void)
+{
+#ifdef HAVE_CODESET
+ char *result = nl_langinfo (CODESET);
+ return g_strdup (result);
+#else
+ /* FIXME: Do something more intelligent based on setlocale (LC_CTYPE, NULL)
+ */
+ return g_strdup ("ISO-8859-1");
+#endif
+}
diff --git a/gutils.c b/gutils.c
index 09646ccb5..f09715ac2 100644
--- a/gutils.c
+++ b/gutils.c
@@ -72,6 +72,10 @@
# include <io.h>
#endif /* G_OS_WIN32 */
+#ifdef HAVE_CODESET
+#include <langinfo.h>
+#endif
+
const guint glib_major_version = GLIB_MAJOR_VERSION;
const guint glib_minor_version = GLIB_MINOR_VERSION;
const guint glib_micro_version = GLIB_MICRO_VERSION;
@@ -756,3 +760,16 @@ g_int_hash (gconstpointer v)
{
return *(const gint*) v;
}
+
+gchar *
+g_locale_get_codeset (void)
+{
+#ifdef HAVE_CODESET
+ char *result = nl_langinfo (CODESET);
+ return g_strdup (result);
+#else
+ /* FIXME: Do something more intelligent based on setlocale (LC_CTYPE, NULL)
+ */
+ return g_strdup ("ISO-8859-1");
+#endif
+}