+Mon May 13 11:42:23 2002 Owen Taylor <otaylor@redhat.com>
+
+ * glib/libcharset/*: Update from libcharset CVS.
+ Includes additional encodings for Solaris (#80396,
+ Qingjiang Yuan)
+
+ * configure.in: Add getc_unlocked to CHECK_FUNCS().
+
+ * glib/gmessages.c (strdup_convert): If
+ g_convert_with_fallback() fails, print the error
+ message to stderr the first time, then return
+ the original string. (#78197)
+
2002-05-10 Naba Kumar <kh_naba@users.sourceforge.net>
* configure.in: Added "hi" to ALL_LINGUAS.
+Mon May 13 11:42:23 2002 Owen Taylor <otaylor@redhat.com>
+
+ * glib/libcharset/*: Update from libcharset CVS.
+ Includes additional encodings for Solaris (#80396,
+ Qingjiang Yuan)
+
+ * configure.in: Add getc_unlocked to CHECK_FUNCS().
+
+ * glib/gmessages.c (strdup_convert): If
+ g_convert_with_fallback() fails, print the error
+ message to stderr the first time, then return
+ the original string. (#78197)
+
2002-05-10 Naba Kumar <kh_naba@users.sourceforge.net>
* configure.in: Added "hi" to ALL_LINGUAS.
+Mon May 13 11:42:23 2002 Owen Taylor <otaylor@redhat.com>
+
+ * glib/libcharset/*: Update from libcharset CVS.
+ Includes additional encodings for Solaris (#80396,
+ Qingjiang Yuan)
+
+ * configure.in: Add getc_unlocked to CHECK_FUNCS().
+
+ * glib/gmessages.c (strdup_convert): If
+ g_convert_with_fallback() fails, print the error
+ message to stderr the first time, then return
+ the original string. (#78197)
+
2002-05-10 Naba Kumar <kh_naba@users.sourceforge.net>
* configure.in: Added "hi" to ALL_LINGUAS.
+Mon May 13 11:42:23 2002 Owen Taylor <otaylor@redhat.com>
+
+ * glib/libcharset/*: Update from libcharset CVS.
+ Includes additional encodings for Solaris (#80396,
+ Qingjiang Yuan)
+
+ * configure.in: Add getc_unlocked to CHECK_FUNCS().
+
+ * glib/gmessages.c (strdup_convert): If
+ g_convert_with_fallback() fails, print the error
+ message to stderr the first time, then return
+ the original string. (#78197)
+
2002-05-10 Naba Kumar <kh_naba@users.sourceforge.net>
* configure.in: Added "hi" to ALL_LINGUAS.
+Mon May 13 11:42:23 2002 Owen Taylor <otaylor@redhat.com>
+
+ * glib/libcharset/*: Update from libcharset CVS.
+ Includes additional encodings for Solaris (#80396,
+ Qingjiang Yuan)
+
+ * configure.in: Add getc_unlocked to CHECK_FUNCS().
+
+ * glib/gmessages.c (strdup_convert): If
+ g_convert_with_fallback() fails, print the error
+ message to stderr the first time, then return
+ the original string. (#78197)
+
2002-05-10 Naba Kumar <kh_naba@users.sourceforge.net>
* configure.in: Added "hi" to ALL_LINGUAS.
+Mon May 13 11:42:23 2002 Owen Taylor <otaylor@redhat.com>
+
+ * glib/libcharset/*: Update from libcharset CVS.
+ Includes additional encodings for Solaris (#80396,
+ Qingjiang Yuan)
+
+ * configure.in: Add getc_unlocked to CHECK_FUNCS().
+
+ * glib/gmessages.c (strdup_convert): If
+ g_convert_with_fallback() fails, print the error
+ message to stderr the first time, then return
+ the original string. (#78197)
+
2002-05-10 Naba Kumar <kh_naba@users.sourceforge.net>
* configure.in: Added "hi" to ALL_LINGUAS.
+Mon May 13 11:42:23 2002 Owen Taylor <otaylor@redhat.com>
+
+ * glib/libcharset/*: Update from libcharset CVS.
+ Includes additional encodings for Solaris (#80396,
+ Qingjiang Yuan)
+
+ * configure.in: Add getc_unlocked to CHECK_FUNCS().
+
+ * glib/gmessages.c (strdup_convert): If
+ g_convert_with_fallback() fails, print the error
+ message to stderr the first time, then return
+ the original string. (#78197)
+
2002-05-10 Naba Kumar <kh_naba@users.sourceforge.net>
* configure.in: Added "hi" to ALL_LINGUAS.
GLIB_SIZEOF([$size_includes], intmax_t, intmax_t)
# Check for some functions
-AC_CHECK_FUNCS(lstat strerror strsignal memmove mkstemp vsnprintf stpcpy strcasecmp strncasecmp poll getcwd nanosleep vasprintf unsetenv)
+AC_CHECK_FUNCS(lstat strerror strsignal memmove mkstemp vsnprintf stpcpy strcasecmp strncasecmp poll getcwd nanosleep vasprintf unsetenv getc_unlocked)
AC_FUNC_VSNPRINTF_C99
</para>
+<!-- ##### MACRO G_TYPE_FUNDAMENTAL_SHIFT ##### -->
+<para>
+Shift value used in converting numbers to type IDs.
+</para>
+
+
<!-- ##### FUNCTION g_closure_add_fnotify ##### -->
<para>
-<!-- ##### MACRO G_TYPE_FUNDAMENTAL_SHIFT ##### -->
-<para>
-Shift value used in converting numbers to type IDs.
-</para>
-
-
-
<!-- ##### MACRO G_TYPE_MAKE_FUNDAMENTAL ##### -->
<para>
Returns the type ID for the fundamental type number @x.
</para>
+
<!-- ##### ENUM GTypeDebugFlags ##### -->
<para>
The <type>GTypeDebugFlags</type> enumeration values can be passed to
type itself, so that e.g. a fundamental type has depth 1.
</para>
-@type: A #GType value.
+@type: A #GType value.
@Returns: The depth of @type.
class is not instantiated.
-
<!-- ##### FUNCTION g_type_interface_peek_parent ##### -->
<para>
if (!g_utf8_validate (string, -1, NULL))
return g_strconcat ("[Invalid UTF-8] ", string, NULL);
else
- return g_convert_with_fallback (string, -1, charset, "UTF-8", "?", NULL, NULL, NULL);
+ {
+ GError *err = NULL;
+
+ gchar *result = g_convert_with_fallback (string, -1, charset, "UTF-8", "?", NULL, NULL, &err);
+ if (result)
+ return result;
+ else
+ {
+ /* Not thread-safe, but doesn't matter if we print the warning twice
+ */
+ static gboolean warned = FALSE;
+ if (!warned)
+ {
+ warned = TRUE;
+ fprintf (stderr, "GLib: Cannot convert message: %s\n", err->message);
+ }
+ g_error_free (err);
+
+ return g_strdup (string);
+ }
+ }
}
/* For a radix of 8 we need at most 3 output bytes for 1 input
#! /bin/sh
# Output a system dependent table of character encoding aliases.
#
-# Copyright (C) 2000-2001 Free Software Foundation, Inc.
+# Copyright (C) 2000-2002 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published
# ISO-8859-8 glibc aix hpux osf solaris yes
# ISO-8859-9 glibc aix hpux irix osf solaris yes
# ISO-8859-13 glibc
+# ISO-8859-14 glibc
# ISO-8859-15 glibc aix osf solaris freebsd
# KOI8-R glibc solaris freebsd yes
# KOI8-U glibc freebsd yes
+# KOI8-T glibc
# CP437 dos
# CP775 dos
# CP850 aix osf dos
# CP865 dos
# CP866 freebsd dos
# CP869 dos
-# CP874 win32 dos
+# CP874 woe32 dos
# CP922 aix
-# CP932 aix win32 dos
+# CP932 aix woe32 dos
# CP943 aix
-# CP949 osf win32 dos
-# CP950 win32 dos
+# CP949 osf woe32 dos
+# CP950 woe32 dos
# CP1046 aix
# CP1124 aix
+# CP1125 dos
# CP1129 aix
-# CP1250 win32
-# CP1251 glibc win32
-# CP1252 aix win32
-# CP1253 win32
-# CP1254 win32
-# CP1255 win32
-# CP1256 win32
-# CP1257 win32
+# CP1250 woe32
+# CP1251 glibc woe32
+# CP1252 aix woe32
+# CP1253 woe32
+# CP1254 woe32
+# CP1255 glibc woe32
+# CP1256 woe32
+# CP1257 woe32
# GB2312 glibc aix hpux irix solaris freebsd yes
# EUC-JP glibc aix hpux irix osf solaris freebsd yes
# EUC-KR glibc aix hpux irix osf solaris freebsd yes
# EUC-TW glibc aix hpux irix osf solaris
# BIG5 glibc aix hpux osf solaris freebsd yes
-# BIG5-HKSCS glibc
-# GBK aix osf win32 dos
-# GB18030 glibc
+# BIG5-HKSCS glibc solaris
+# GBK glibc aix osf solaris woe32 dos
+# GB18030 glibc solaris
# SHIFT_JIS hpux osf solaris freebsd yes
-# JOHAB glibc win32
+# JOHAB glibc solaris woe32
# TIS-620 glibc aix hpux osf solaris
# VISCII glibc yes
+# TCVN5712-1 glibc
+# GEORGIAN-PS glibc
# HP-ROMAN8 hpux
# HP-ARABIC8 hpux
# HP-GREEK8 hpux
echo "ISO8859-15 ISO-8859-15"
echo "koi8-r KOI8-R"
echo "BIG5 BIG5"
+ echo "Big5-HKSCS BIG5-HKSCS"
echo "gb2312 GB2312"
+ echo "GBK GBK"
+ echo "GB18030 GB18030"
echo "cns11643 EUC-TW"
echo "5601 EUC-KR"
+ echo "ko_KR.johap92 JOHAB"
echo "eucJP EUC-JP"
echo "PCK SHIFT_JIS"
echo "TIS620.2533 TIS-620"
#echo "sun_eu_greek ?" # what is this?
echo "UTF-8 UTF-8"
;;
- freebsd*)
+ freebsd* | os2*)
# FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
# localcharset.c falls back to using the full locale name
# from the environment variables.
+ # Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just
+ # reuse FreeBSD's locale data for OS/2.
echo "C ASCII"
echo "US-ASCII ASCII"
for l in la_LN lt_LN; do
echo "ja_JP.Shift_JIS SHIFT_JIS"
echo "ko_KR.EUC EUC-KR"
;;
+ netbsd*)
+ echo "646 ASCII"
+ echo "ISO8859-1 ISO-8859-1"
+ echo "ISO8859-2 ISO-8859-2"
+ echo "ISO8859-4 ISO-8859-4"
+ echo "ISO8859-5 ISO-8859-5"
+ echo "ISO8859-15 ISO-8859-15"
+ echo "eucCN GB2312"
+ echo "eucJP EUC-JP"
+ echo "eucKR EUC-KR"
+ echo "eucTW EUC-TW"
+ echo "BIG5 BIG5"
+ echo "SJIS SHIFT_JIS"
+ ;;
beos*)
# BeOS has a single locale, and it has UTF-8 encoding.
echo "* UTF-8"
echo "# country is not the one your DOS machine actually uses, just"
echo "# correct it in this file, and send a mail to"
echo "# Juan Manuel Guerrero <st001906@hrz1.hrz.tu-darmstadt.de>"
- echo "# and Bruno Haible <haible@clisp.cons.org>."
+ echo "# and Bruno Haible <bruno@clisp.org>."
echo "#"
echo "C ASCII"
# ISO-8859-1 languages
echo "bg_BG CP866" # not CP855 ??
echo "mk CP866" # not CP855 ??
echo "mk_MK CP866" # not CP855 ??
- echo "ru KOI8-R" # not CP866 ??
- echo "ru_RU KOI8-R" # not CP866 ??
+ echo "ru CP866"
+ echo "ru_RU CP866"
+ echo "uk CP1125"
+ echo "uk_UA CP1125"
# ISO-8859-6 languages
echo "ar CP864"
echo "ar_AE CP864"
echo "eo CP850"
echo "eo_EO CP850"
;;
- netbsd*)
- echo "646 ASCII"
- ;;
esac
/* Determine a canonical name for the current locale's character encoding.
- Copyright (C) 2000-2001 Free Software Foundation, Inc.
+ Copyright (C) 2000-2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
-/* Written by Bruno Haible <haible@clisp.cons.org>. */
+/* Written by Bruno Haible <bruno@clisp.org>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
# define WIN32
#endif
-#ifndef WIN32
+#if defined __EMX__
+/* Assume EMX program runs on OS/2, even if compiled under DOS. */
+# define OS2
+#endif
+
+#if !defined WIN32
# if HAVE_LANGINFO_CODESET
# include <langinfo.h>
# else
# include <locale.h>
# endif
# endif
-#else /* WIN32 */
+#elif defined WIN32
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif
+#if defined OS2
+# define INCL_DOS
+# include <os2.h>
+#endif
+
+#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
+ /* Win32, OS/2, DOS */
+# define ISSLASH(C) ((C) == '/' || (C) == '\\')
+#endif
#ifndef DIRECTORY_SEPARATOR
# define DIRECTORY_SEPARATOR '/'
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
#endif
+#ifdef HAVE_GETC_UNLOCKED
+# undef getc
+# define getc getc_unlocked
+#endif
+
#ifdef __cplusplus
/* When compiling with "gcc -x c++", produce a function with C linkage. */
extern "C" const char * locale_charset (void);
cp = charset_aliases;
if (cp == NULL)
{
-#ifndef WIN32
+#if !defined WIN32
FILE *fp;
- const char *dir = getenv ("LIBCHARSET_ALIAS_DIR");
+ const char *dir = LIBDIR;
const char *base = "charset.alias";
char *file_name;
- if (dir == NULL)
- dir = LIBDIR;
-
/* Concatenate dir and base into freshly allocated file_name. */
{
size_t dir_len = strlen (dir);
continue;
}
ungetc (c, fp);
- if (fscanf(fp, "%50s %50s", buf1, buf2) < 2)
+ if (fscanf (fp, "%50s %50s", buf1, buf2) < 2)
break;
l1 = strlen (buf1);
l2 = strlen (buf2);
if (file_name != NULL)
free (file_name);
-#else /* WIN32 */
+#else
/* To avoid the troubles of installing a separate file in the same
directory as the DLL and of retrieving the DLL's directory at
runtime, simply inline the aliases here. */
+# if defined WIN32
cp = "CP936" "\0" "GBK" "\0"
- "CP1361" "\0" "JOHAB" "\0";
+ "CP1361" "\0" "JOHAB" "\0"
+ "CP20127" "\0" "ASCII" "\0"
+ "CP20866" "\0" "KOI8-R" "\0"
+ "CP21866" "\0" "KOI8-RU" "\0"
+ "CP28591" "\0" "ISO-8859-1" "\0"
+ "CP28592" "\0" "ISO-8859-2" "\0"
+ "CP28593" "\0" "ISO-8859-3" "\0"
+ "CP28594" "\0" "ISO-8859-4" "\0"
+ "CP28595" "\0" "ISO-8859-5" "\0"
+ "CP28596" "\0" "ISO-8859-6" "\0"
+ "CP28597" "\0" "ISO-8859-7" "\0"
+ "CP28598" "\0" "ISO-8859-8" "\0"
+ "CP28599" "\0" "ISO-8859-9" "\0"
+ "CP28605" "\0" "ISO-8859-15" "\0";
+# endif
#endif
charset_aliases = cp;
const char *codeset;
const char *aliases;
-#ifndef WIN32
+#if !(defined WIN32 || defined OS2)
# if HAVE_LANGINFO_CODESET
# endif
-#else /* WIN32 */
+#elif defined WIN32
static char buf[2 + 10 + 1];
- /* Win32 has a function returning the locale's codepage as a number. */
+ /* Woe32 has a function returning the locale's codepage as a number. */
sprintf (buf, "CP%u", GetACP ());
codeset = buf;
+#elif defined OS2
+
+ const char *locale;
+ static char buf[2 + 10 + 1];
+ ULONG cp[3];
+ ULONG cplen;
+
+ /* Allow user to override the codeset, as set in the operating system,
+ with standard language environment variables. */
+ locale = getenv ("LC_ALL");
+ if (locale == NULL || locale[0] == '\0')
+ {
+ locale = getenv ("LC_CTYPE");
+ if (locale == NULL || locale[0] == '\0')
+ locale = getenv ("LANG");
+ }
+ if (locale != NULL && locale[0] != '\0')
+ {
+ /* If the locale name contains an encoding after the dot, return it. */
+ const char *dot = strchr (locale, '.');
+
+ if (dot != NULL)
+ {
+ const char *modifier;
+
+ dot++;
+ /* Look for the possible @... trailer and remove it, if any. */
+ modifier = strchr (dot, '@');
+ if (modifier == NULL)
+ return dot;
+ if (modifier - dot < sizeof (buf))
+ {
+ memcpy (buf, dot, modifier - dot);
+ buf [modifier - dot] = '\0';
+ return buf;
+ }
+ }
+
+ /* Resolve through the charset.alias file. */
+ codeset = locale;
+ }
+ else
+ {
+ /* OS/2 has a function returning the locale's codepage as a number. */
+ if (DosQueryCp (sizeof (cp), cp, &cplen))
+ codeset = "";
+ else
+ {
+ sprintf (buf, "CP%u", cp[0]);
+ codeset = buf;
+ }
+ }
+
#endif
if (codeset == NULL)
break;
}
+ /* Don't return an empty string. GNU libc and GNU libiconv interpret
+ the empty string as denoting "the locale's character encoding",
+ thus GNU libiconv would call this function a second time. */
+ if (codeset[0] == '\0')
+ codeset = "ASCII";
+
return codeset;
}
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.
#
-# Written by Bruno Haible <haible@clisp.cons.org>.
+# Written by Bruno Haible <bruno@clisp.org>.
#
/^# Packages using this file: / {
s/# Packages using this file://
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.
#
-# Written by Bruno Haible <haible@clisp.cons.org>.
+# Written by Bruno Haible <bruno@clisp.org>.
#
/^# Packages using this file: / {
s/# Packages using this file://