mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-28 10:07:13 +02:00
Update from libcharset CVS. Includes additional encodings for Solaris
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)
This commit is contained in:
13
ChangeLog
13
ChangeLog
@@ -1,3 +1,16 @@
|
|||||||
|
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>
|
2002-05-10 Naba Kumar <kh_naba@users.sourceforge.net>
|
||||||
|
|
||||||
* configure.in: Added "hi" to ALL_LINGUAS.
|
* configure.in: Added "hi" to ALL_LINGUAS.
|
||||||
|
@@ -1,3 +1,16 @@
|
|||||||
|
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>
|
2002-05-10 Naba Kumar <kh_naba@users.sourceforge.net>
|
||||||
|
|
||||||
* configure.in: Added "hi" to ALL_LINGUAS.
|
* configure.in: Added "hi" to ALL_LINGUAS.
|
||||||
|
@@ -1,3 +1,16 @@
|
|||||||
|
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>
|
2002-05-10 Naba Kumar <kh_naba@users.sourceforge.net>
|
||||||
|
|
||||||
* configure.in: Added "hi" to ALL_LINGUAS.
|
* configure.in: Added "hi" to ALL_LINGUAS.
|
||||||
|
@@ -1,3 +1,16 @@
|
|||||||
|
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>
|
2002-05-10 Naba Kumar <kh_naba@users.sourceforge.net>
|
||||||
|
|
||||||
* configure.in: Added "hi" to ALL_LINGUAS.
|
* configure.in: Added "hi" to ALL_LINGUAS.
|
||||||
|
@@ -1,3 +1,16 @@
|
|||||||
|
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>
|
2002-05-10 Naba Kumar <kh_naba@users.sourceforge.net>
|
||||||
|
|
||||||
* configure.in: Added "hi" to ALL_LINGUAS.
|
* configure.in: Added "hi" to ALL_LINGUAS.
|
||||||
|
@@ -1,3 +1,16 @@
|
|||||||
|
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>
|
2002-05-10 Naba Kumar <kh_naba@users.sourceforge.net>
|
||||||
|
|
||||||
* configure.in: Added "hi" to ALL_LINGUAS.
|
* configure.in: Added "hi" to ALL_LINGUAS.
|
||||||
|
@@ -1,3 +1,16 @@
|
|||||||
|
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>
|
2002-05-10 Naba Kumar <kh_naba@users.sourceforge.net>
|
||||||
|
|
||||||
* configure.in: Added "hi" to ALL_LINGUAS.
|
* configure.in: Added "hi" to ALL_LINGUAS.
|
||||||
|
@@ -579,7 +579,7 @@ GLIB_SIZEOF([$size_includes], ptrdiff_t, ptrdiff_t)
|
|||||||
GLIB_SIZEOF([$size_includes], intmax_t, intmax_t)
|
GLIB_SIZEOF([$size_includes], intmax_t, intmax_t)
|
||||||
|
|
||||||
# Check for some functions
|
# 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
|
AC_FUNC_VSNPRINTF_C99
|
||||||
|
|
||||||
|
@@ -122,6 +122,12 @@ The predefined identifiers of the reserved fundamental types.
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### MACRO G_TYPE_FUNDAMENTAL_SHIFT ##### -->
|
||||||
|
<para>
|
||||||
|
Shift value used in converting numbers to type IDs.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION g_closure_add_fnotify ##### -->
|
<!-- ##### FUNCTION g_closure_add_fnotify ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@@ -63,13 +63,6 @@ for types that are assigned at compile-time.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO G_TYPE_FUNDAMENTAL_SHIFT ##### -->
|
|
||||||
<para>
|
|
||||||
Shift value used in converting numbers to type IDs.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO G_TYPE_MAKE_FUNDAMENTAL ##### -->
|
<!-- ##### MACRO G_TYPE_MAKE_FUNDAMENTAL ##### -->
|
||||||
<para>
|
<para>
|
||||||
Returns the type ID for the fundamental type number @x.
|
Returns the type ID for the fundamental type number @x.
|
||||||
@@ -540,6 +533,7 @@ type implementations or the signal system).
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### ENUM GTypeDebugFlags ##### -->
|
<!-- ##### ENUM GTypeDebugFlags ##### -->
|
||||||
<para>
|
<para>
|
||||||
The <type>GTypeDebugFlags</type> enumeration values can be passed to
|
The <type>GTypeDebugFlags</type> enumeration values can be passed to
|
||||||
@@ -704,7 +698,6 @@ class conforms.
|
|||||||
class is not instantiated.
|
class is not instantiated.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION g_type_interface_peek_parent ##### -->
|
<!-- ##### FUNCTION g_type_interface_peek_parent ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@@ -534,7 +534,27 @@ strdup_convert (const gchar *string,
|
|||||||
if (!g_utf8_validate (string, -1, NULL))
|
if (!g_utf8_validate (string, -1, NULL))
|
||||||
return g_strconcat ("[Invalid UTF-8] ", string, NULL);
|
return g_strconcat ("[Invalid UTF-8] ", string, NULL);
|
||||||
else
|
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
|
/* For a radix of 8 we need at most 3 output bytes for 1 input
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Output a system dependent table of character encoding aliases.
|
# 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
|
# 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
|
# under the terms of the GNU Library General Public License as published
|
||||||
@@ -42,9 +42,11 @@
|
|||||||
# ISO-8859-8 glibc aix hpux osf solaris yes
|
# ISO-8859-8 glibc aix hpux osf solaris yes
|
||||||
# ISO-8859-9 glibc aix hpux irix osf solaris yes
|
# ISO-8859-9 glibc aix hpux irix osf solaris yes
|
||||||
# ISO-8859-13 glibc
|
# ISO-8859-13 glibc
|
||||||
|
# ISO-8859-14 glibc
|
||||||
# ISO-8859-15 glibc aix osf solaris freebsd
|
# ISO-8859-15 glibc aix osf solaris freebsd
|
||||||
# KOI8-R glibc solaris freebsd yes
|
# KOI8-R glibc solaris freebsd yes
|
||||||
# KOI8-U glibc freebsd yes
|
# KOI8-U glibc freebsd yes
|
||||||
|
# KOI8-T glibc
|
||||||
# CP437 dos
|
# CP437 dos
|
||||||
# CP775 dos
|
# CP775 dos
|
||||||
# CP850 aix osf dos
|
# CP850 aix osf dos
|
||||||
@@ -58,35 +60,38 @@
|
|||||||
# CP865 dos
|
# CP865 dos
|
||||||
# CP866 freebsd dos
|
# CP866 freebsd dos
|
||||||
# CP869 dos
|
# CP869 dos
|
||||||
# CP874 win32 dos
|
# CP874 woe32 dos
|
||||||
# CP922 aix
|
# CP922 aix
|
||||||
# CP932 aix win32 dos
|
# CP932 aix woe32 dos
|
||||||
# CP943 aix
|
# CP943 aix
|
||||||
# CP949 osf win32 dos
|
# CP949 osf woe32 dos
|
||||||
# CP950 win32 dos
|
# CP950 woe32 dos
|
||||||
# CP1046 aix
|
# CP1046 aix
|
||||||
# CP1124 aix
|
# CP1124 aix
|
||||||
|
# CP1125 dos
|
||||||
# CP1129 aix
|
# CP1129 aix
|
||||||
# CP1250 win32
|
# CP1250 woe32
|
||||||
# CP1251 glibc win32
|
# CP1251 glibc woe32
|
||||||
# CP1252 aix win32
|
# CP1252 aix woe32
|
||||||
# CP1253 win32
|
# CP1253 woe32
|
||||||
# CP1254 win32
|
# CP1254 woe32
|
||||||
# CP1255 win32
|
# CP1255 glibc woe32
|
||||||
# CP1256 win32
|
# CP1256 woe32
|
||||||
# CP1257 win32
|
# CP1257 woe32
|
||||||
# GB2312 glibc aix hpux irix solaris freebsd yes
|
# GB2312 glibc aix hpux irix solaris freebsd yes
|
||||||
# EUC-JP glibc aix hpux irix osf solaris freebsd yes
|
# EUC-JP glibc aix hpux irix osf solaris freebsd yes
|
||||||
# EUC-KR 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
|
# EUC-TW glibc aix hpux irix osf solaris
|
||||||
# BIG5 glibc aix hpux osf solaris freebsd yes
|
# BIG5 glibc aix hpux osf solaris freebsd yes
|
||||||
# BIG5-HKSCS glibc
|
# BIG5-HKSCS glibc solaris
|
||||||
# GBK aix osf win32 dos
|
# GBK glibc aix osf solaris woe32 dos
|
||||||
# GB18030 glibc
|
# GB18030 glibc solaris
|
||||||
# SHIFT_JIS hpux osf solaris freebsd yes
|
# SHIFT_JIS hpux osf solaris freebsd yes
|
||||||
# JOHAB glibc win32
|
# JOHAB glibc solaris woe32
|
||||||
# TIS-620 glibc aix hpux osf solaris
|
# TIS-620 glibc aix hpux osf solaris
|
||||||
# VISCII glibc yes
|
# VISCII glibc yes
|
||||||
|
# TCVN5712-1 glibc
|
||||||
|
# GEORGIAN-PS glibc
|
||||||
# HP-ROMAN8 hpux
|
# HP-ROMAN8 hpux
|
||||||
# HP-ARABIC8 hpux
|
# HP-ARABIC8 hpux
|
||||||
# HP-GREEK8 hpux
|
# HP-GREEK8 hpux
|
||||||
@@ -227,19 +232,25 @@ case "$os" in
|
|||||||
echo "ISO8859-15 ISO-8859-15"
|
echo "ISO8859-15 ISO-8859-15"
|
||||||
echo "koi8-r KOI8-R"
|
echo "koi8-r KOI8-R"
|
||||||
echo "BIG5 BIG5"
|
echo "BIG5 BIG5"
|
||||||
|
echo "Big5-HKSCS BIG5-HKSCS"
|
||||||
echo "gb2312 GB2312"
|
echo "gb2312 GB2312"
|
||||||
|
echo "GBK GBK"
|
||||||
|
echo "GB18030 GB18030"
|
||||||
echo "cns11643 EUC-TW"
|
echo "cns11643 EUC-TW"
|
||||||
echo "5601 EUC-KR"
|
echo "5601 EUC-KR"
|
||||||
|
echo "ko_KR.johap92 JOHAB"
|
||||||
echo "eucJP EUC-JP"
|
echo "eucJP EUC-JP"
|
||||||
echo "PCK SHIFT_JIS"
|
echo "PCK SHIFT_JIS"
|
||||||
echo "TIS620.2533 TIS-620"
|
echo "TIS620.2533 TIS-620"
|
||||||
#echo "sun_eu_greek ?" # what is this?
|
#echo "sun_eu_greek ?" # what is this?
|
||||||
echo "UTF-8 UTF-8"
|
echo "UTF-8 UTF-8"
|
||||||
;;
|
;;
|
||||||
freebsd*)
|
freebsd* | os2*)
|
||||||
# FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
|
# FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
|
||||||
# localcharset.c falls back to using the full locale name
|
# localcharset.c falls back to using the full locale name
|
||||||
# from the environment variables.
|
# 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 "C ASCII"
|
||||||
echo "US-ASCII ASCII"
|
echo "US-ASCII ASCII"
|
||||||
for l in la_LN lt_LN; do
|
for l in la_LN lt_LN; do
|
||||||
@@ -271,6 +282,20 @@ case "$os" in
|
|||||||
echo "ja_JP.Shift_JIS SHIFT_JIS"
|
echo "ja_JP.Shift_JIS SHIFT_JIS"
|
||||||
echo "ko_KR.EUC EUC-KR"
|
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*)
|
||||||
# BeOS has a single locale, and it has UTF-8 encoding.
|
# BeOS has a single locale, and it has UTF-8 encoding.
|
||||||
echo "* UTF-8"
|
echo "* UTF-8"
|
||||||
@@ -285,7 +310,7 @@ case "$os" in
|
|||||||
echo "# country is not the one your DOS machine actually uses, just"
|
echo "# country is not the one your DOS machine actually uses, just"
|
||||||
echo "# correct it in this file, and send a mail to"
|
echo "# correct it in this file, and send a mail to"
|
||||||
echo "# Juan Manuel Guerrero <st001906@hrz1.hrz.tu-darmstadt.de>"
|
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 "#"
|
||||||
echo "C ASCII"
|
echo "C ASCII"
|
||||||
# ISO-8859-1 languages
|
# ISO-8859-1 languages
|
||||||
@@ -395,8 +420,10 @@ case "$os" in
|
|||||||
echo "bg_BG CP866" # not CP855 ??
|
echo "bg_BG CP866" # not CP855 ??
|
||||||
echo "mk CP866" # not CP855 ??
|
echo "mk CP866" # not CP855 ??
|
||||||
echo "mk_MK CP866" # not CP855 ??
|
echo "mk_MK CP866" # not CP855 ??
|
||||||
echo "ru KOI8-R" # not CP866 ??
|
echo "ru CP866"
|
||||||
echo "ru_RU KOI8-R" # not CP866 ??
|
echo "ru_RU CP866"
|
||||||
|
echo "uk CP1125"
|
||||||
|
echo "uk_UA CP1125"
|
||||||
# ISO-8859-6 languages
|
# ISO-8859-6 languages
|
||||||
echo "ar CP864"
|
echo "ar CP864"
|
||||||
echo "ar_AE CP864"
|
echo "ar_AE CP864"
|
||||||
@@ -436,7 +463,4 @@ case "$os" in
|
|||||||
echo "eo CP850"
|
echo "eo CP850"
|
||||||
echo "eo_EO CP850"
|
echo "eo_EO CP850"
|
||||||
;;
|
;;
|
||||||
netbsd*)
|
|
||||||
echo "646 ASCII"
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/* Determine a canonical name for the current locale's character encoding.
|
/* 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
|
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
|
under the terms of the GNU Library General Public License as published
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
USA. */
|
USA. */
|
||||||
|
|
||||||
/* Written by Bruno Haible <haible@clisp.cons.org>. */
|
/* Written by Bruno Haible <bruno@clisp.org>. */
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
@@ -42,7 +42,12 @@
|
|||||||
# define WIN32
|
# define WIN32
|
||||||
#endif
|
#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
|
# if HAVE_LANGINFO_CODESET
|
||||||
# include <langinfo.h>
|
# include <langinfo.h>
|
||||||
# else
|
# else
|
||||||
@@ -50,10 +55,19 @@
|
|||||||
# include <locale.h>
|
# include <locale.h>
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#else /* WIN32 */
|
#elif defined WIN32
|
||||||
# define WIN32_LEAN_AND_MEAN
|
# define WIN32_LEAN_AND_MEAN
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#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
|
#ifndef DIRECTORY_SEPARATOR
|
||||||
# define DIRECTORY_SEPARATOR '/'
|
# define DIRECTORY_SEPARATOR '/'
|
||||||
@@ -63,6 +77,11 @@
|
|||||||
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
|
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_GETC_UNLOCKED
|
||||||
|
# undef getc
|
||||||
|
# define getc getc_unlocked
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
/* When compiling with "gcc -x c++", produce a function with C linkage. */
|
/* When compiling with "gcc -x c++", produce a function with C linkage. */
|
||||||
extern "C" const char * locale_charset (void);
|
extern "C" const char * locale_charset (void);
|
||||||
@@ -91,15 +110,12 @@ _g_locale_get_charset_aliases ()
|
|||||||
cp = charset_aliases;
|
cp = charset_aliases;
|
||||||
if (cp == NULL)
|
if (cp == NULL)
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
#if !defined WIN32
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
const char *dir = getenv ("LIBCHARSET_ALIAS_DIR");
|
const char *dir = LIBDIR;
|
||||||
const char *base = "charset.alias";
|
const char *base = "charset.alias";
|
||||||
char *file_name;
|
char *file_name;
|
||||||
|
|
||||||
if (dir == NULL)
|
|
||||||
dir = LIBDIR;
|
|
||||||
|
|
||||||
/* Concatenate dir and base into freshly allocated file_name. */
|
/* Concatenate dir and base into freshly allocated file_name. */
|
||||||
{
|
{
|
||||||
size_t dir_len = strlen (dir);
|
size_t dir_len = strlen (dir);
|
||||||
@@ -146,7 +162,7 @@ _g_locale_get_charset_aliases ()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ungetc (c, fp);
|
ungetc (c, fp);
|
||||||
if (fscanf(fp, "%50s %50s", buf1, buf2) < 2)
|
if (fscanf (fp, "%50s %50s", buf1, buf2) < 2)
|
||||||
break;
|
break;
|
||||||
l1 = strlen (buf1);
|
l1 = strlen (buf1);
|
||||||
l2 = strlen (buf2);
|
l2 = strlen (buf2);
|
||||||
@@ -182,14 +198,29 @@ _g_locale_get_charset_aliases ()
|
|||||||
if (file_name != NULL)
|
if (file_name != NULL)
|
||||||
free (file_name);
|
free (file_name);
|
||||||
|
|
||||||
#else /* WIN32 */
|
#else
|
||||||
|
|
||||||
/* To avoid the troubles of installing a separate file in the same
|
/* To avoid the troubles of installing a separate file in the same
|
||||||
directory as the DLL and of retrieving the DLL's directory at
|
directory as the DLL and of retrieving the DLL's directory at
|
||||||
runtime, simply inline the aliases here. */
|
runtime, simply inline the aliases here. */
|
||||||
|
|
||||||
|
# if defined WIN32
|
||||||
cp = "CP936" "\0" "GBK" "\0"
|
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
|
#endif
|
||||||
|
|
||||||
charset_aliases = cp;
|
charset_aliases = cp;
|
||||||
@@ -213,7 +244,7 @@ _g_locale_charset ()
|
|||||||
const char *codeset;
|
const char *codeset;
|
||||||
const char *aliases;
|
const char *aliases;
|
||||||
|
|
||||||
#ifndef WIN32
|
#if !(defined WIN32 || defined OS2)
|
||||||
|
|
||||||
# if HAVE_LANGINFO_CODESET
|
# if HAVE_LANGINFO_CODESET
|
||||||
|
|
||||||
@@ -250,14 +281,67 @@ _g_locale_charset ()
|
|||||||
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#else /* WIN32 */
|
#elif defined WIN32
|
||||||
|
|
||||||
static char buf[2 + 10 + 1];
|
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 ());
|
sprintf (buf, "CP%u", GetACP ());
|
||||||
codeset = buf;
|
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
|
#endif
|
||||||
|
|
||||||
if (codeset == NULL)
|
if (codeset == NULL)
|
||||||
@@ -275,5 +359,11 @@ _g_locale_charset ()
|
|||||||
break;
|
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;
|
return codeset;
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
# USA.
|
# USA.
|
||||||
#
|
#
|
||||||
# Written by Bruno Haible <haible@clisp.cons.org>.
|
# Written by Bruno Haible <bruno@clisp.org>.
|
||||||
#
|
#
|
||||||
/^# Packages using this file: / {
|
/^# Packages using this file: / {
|
||||||
s/# Packages using this file://
|
s/# Packages using this file://
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
# USA.
|
# USA.
|
||||||
#
|
#
|
||||||
# Written by Bruno Haible <haible@clisp.cons.org>.
|
# Written by Bruno Haible <bruno@clisp.org>.
|
||||||
#
|
#
|
||||||
/^# Packages using this file: / {
|
/^# Packages using this file: / {
|
||||||
s/# Packages using this file://
|
s/# Packages using this file://
|
||||||
|
Reference in New Issue
Block a user