+2019-12-20 Bruno Haible <bruno@clisp.org>
+
+ iconv_open: Add support for z/OS encoding names.
+ Reported by Daniel Richard G. in
+ <https://lists.gnu.org/archive/html/bug-gnulib/2019-12/msg00172.html>.
+ * lib/iconv_open-zos.gperf: New file.
+ * modules/iconv_open (Files): Add iconv_open-zos.gperf.
+ (Makefile.am): Add rules for generating iconv_open-zos.h from it.
+ * lib/iconv_open.c (ICONV_FLAVOR_ZOS): New macro.
+ * m4/iconv_open.m4 (gl_FUNC_ICONV_OPEN): On z/OS, use ICONV_FLAVOR_ZOS.
+ * doc/posix-functions/iconv_open.texi: Mention z/OS.
+
2019-12-20 Bruno Haible <bruno@clisp.org>
doc: Document the problem of the per-thread locale functions on z/OS.
@item
This function recognizes only non-standard aliases for many encodings (not
the IANA registered encoding names) on many platforms:
-AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 11 2010-11.
+AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 11 2010-11, z/OS.
@end itemize
Portability problems fixed by Gnulib module @code{iconv_open-utf}:
--- /dev/null
+/* Character set conversion.
+ Copyright (C) 2019 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, see <https://www.gnu.org/licenses/>. */
+
+struct mapping { int standard_name; const char vendor_name[10 + 1]; };
+%struct-type
+%language=ANSI-C
+%define slot-name standard_name
+%define hash-function-name mapping_hash
+%define lookup-function-name mapping_lookup
+%readonly-tables
+%global-table
+%define word-array-name mappings
+%pic
+%%
+ASCII, "00367"
+ISO-8859-1, "ISO8859-1"
+ISO-8859-2, "ISO8859-2"
+ISO-8859-4, "ISO8859-4"
+ISO-8859-5, "ISO8859-5"
+ISO-8859-6, "ISO8859-6"
+ISO-8859-7, "ISO8859-7"
+ISO-8859-8, "ISO8859-8"
+ISO-8859-9, "ISO8859-9"
+ISO-8859-13, "ISO8859-13"
+ISO-8859-15, "ISO8859-15"
+CP437, "IBM-437"
+CP850, "IBM-850"
+CP852, "IBM-852"
+CP855, "IBM-855"
+CP856, "IBM-856"
+CP861, "IBM-861"
+CP862, "IBM-862"
+CP864, "IBM-864"
+CP866, "IBM-866"
+CP869, "IBM-869"
+CP874, "TIS-620"
+CP922, "IBM-922"
+CP932, "IBM-eucJC"
+CP943, "IBM-943"
+CP949, "IBM-949"
+CP1046, "IBM-1046"
+CP1124, "IBM-1124"
+CP1125, "IBM-1125"
+CP1250, "IBM-1250"
+CP1251, "IBM-1251"
+CP1252, "IBM-1252"
+CP1253, "IBM-1253"
+CP1254, "IBM-1254"
+CP1255, "IBM-1255"
+CP1256, "IBM-1256"
+GB2312, "IBM-eucCN"
+EUC-JP, "EUCJP"
+EUC-KR, "IBM-eucKR"
+EUC-TW, "IBM-eucTW"
+GBK, "IBM-936"
#define ICONV_FLAVOR_IRIX "iconv_open-irix.h"
#define ICONV_FLAVOR_OSF "iconv_open-osf.h"
#define ICONV_FLAVOR_SOLARIS "iconv_open-solaris.h"
+#define ICONV_FLAVOR_ZOS "iconv_open-zos.h"
#ifdef ICONV_FLAVOR
# include ICONV_FLAVOR
-# iconv_open.m4 serial 15
+# iconv_open.m4 serial 16
dnl Copyright (C) 2007-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
if test $gl_func_iconv_gnu = no; then
iconv_flavor=
case "$host_os" in
- aix*) iconv_flavor=ICONV_FLAVOR_AIX ;;
- irix*) iconv_flavor=ICONV_FLAVOR_IRIX ;;
- hpux*) iconv_flavor=ICONV_FLAVOR_HPUX ;;
- osf*) iconv_flavor=ICONV_FLAVOR_OSF ;;
- solaris*) iconv_flavor=ICONV_FLAVOR_SOLARIS ;;
+ aix*) iconv_flavor=ICONV_FLAVOR_AIX ;;
+ irix*) iconv_flavor=ICONV_FLAVOR_IRIX ;;
+ hpux*) iconv_flavor=ICONV_FLAVOR_HPUX ;;
+ osf*) iconv_flavor=ICONV_FLAVOR_OSF ;;
+ solaris*) iconv_flavor=ICONV_FLAVOR_SOLARIS ;;
+ openedition*) iconv_flavor=ICONV_FLAVOR_ZOS ;;
esac
if test -n "$iconv_flavor"; then
AC_DEFINE_UNQUOTED([ICONV_FLAVOR], [$iconv_flavor],
lib/iconv_open-irix.gperf
lib/iconv_open-osf.gperf
lib/iconv_open-solaris.gperf
+lib/iconv_open-zos.gperf
lib/iconv.c
lib/iconv_close.c
m4/iconv_open.m4
$(srcdir)/iconv_open-solaris.h: $(srcdir)/iconv_open-solaris.gperf
$(V_GPERF)$(GPERF) -m 10 $(srcdir)/iconv_open-solaris.gperf > $(srcdir)/iconv_open-solaris.h-t && \
mv $(srcdir)/iconv_open-solaris.h-t $(srcdir)/iconv_open-solaris.h
-BUILT_SOURCES += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h
-MOSTLYCLEANFILES += iconv_open-aix.h-t iconv_open-hpux.h-t iconv_open-irix.h-t iconv_open-osf.h-t iconv_open-solaris.h-t
-MAINTAINERCLEANFILES += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h
-EXTRA_DIST += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h
+$(srcdir)/iconv_open-zos.h: $(srcdir)/iconv_open-zos.gperf
+ $(V_GPERF)$(GPERF) -m 10 $(srcdir)/iconv_open-zos.gperf > $(srcdir)/iconv_open-zos.h-t && \
+ mv $(srcdir)/iconv_open-zos.h-t $(srcdir)/iconv_open-zos.h
+BUILT_SOURCES += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h iconv_open-zos.h
+MOSTLYCLEANFILES += iconv_open-aix.h-t iconv_open-hpux.h-t iconv_open-irix.h-t iconv_open-osf.h-t iconv_open-solaris.h-t iconv_open-zos.h-t
+MAINTAINERCLEANFILES += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h iconv_open-zos.h
+EXTRA_DIST += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h iconv_open-zos.h
Include:
<iconv.h>