summaryrefslogtreecommitdiff
path: root/gutils.c
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 /gutils.c
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);
Diffstat (limited to 'gutils.c')
-rw-r--r--gutils.c17
1 files changed, 17 insertions, 0 deletions
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
+}