[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: z/OS, iconv, and charset aliases
From: |
Bruno Haible |
Subject: |
Re: z/OS, iconv, and charset aliases |
Date: |
Thu, 19 Dec 2019 06:16:38 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-166-generic; KDE/5.18.0; x86_64; ; ) |
Hi Daniel,
In <https://lists.gnu.org/archive/html/bug-gnulib/2015-10/msg00020.html>
you submitted this patch, which Paul committed on 2016-08-18:
> Also, iconv_open() on
> z/OS does not recognize "ISO-8859-1", but "ISO8859-1" works.
diff --git a/tests/test-iconv.c b/tests/test-iconv.c
index ed715bd..a64c6dd 100644
--- a/tests/test-iconv.c
+++ b/tests/test-iconv.c
@@ -44,8 +44,14 @@ main ()
#if HAVE_ICONV
/* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
and UTF-8. */
- iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
- iconv_t cd_utf8_to_88591 = iconv_open ("ISO-8859-1", "UTF-8");
+ iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO8859-1");
+ iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
+
This part is not right. The approach we take regarding charset/encoding
aliases is that
- locale_charset() produces canonicalized charset names
(see localcharset.h for the precise list, e.g. "UTF-8" not "UTF8",
"ISO-8859-1" not "ISO8859-1", "CP1252" not "WINDOWS-1252", etc.),
- glibc is known to support these canonicalized charset names,
- All functions are supposed to receive canonical, not system-dependent
charset names.
In particular, the gnulib iconv_open module is supposed to receive an
encoding name such as "ISO-8859-1" as argument and, on platforms which
don't understand it, pass "ISO8859-1" (on whatever the platform likes)
to the platform's iconv_open() function. The way this is done is by
adding a gperf-syntax data file to the 'iconv_open' module. To create
such a file, I would need from you the list of encoding names, as z/OS
lists them. You can also take lib/iconv_open-aix.gperf as a template.
Packages such gettext are passing an encoding name "ISO-8859-1" to
iconv_open, and the unit test is supposed to verify that this works.
2019-12-19 Bruno Haible <address@hidden>
iconv tests: Test canonicalized, not system-dependent, encoding names.
* tests/test-iconv.c (main): Revert part of the 2016-08-17 patch.
diff --git a/tests/test-iconv.c b/tests/test-iconv.c
index 3fe9e30..ef1e681 100644
--- a/tests/test-iconv.c
+++ b/tests/test-iconv.c
@@ -44,8 +44,8 @@ main ()
#if HAVE_ICONV
/* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
and UTF-8. */
- iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO8859-1");
- iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
+ iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
+ iconv_t cd_utf8_to_88591 = iconv_open ("ISO-8859-1", "UTF-8");
#if defined __MVS__ && defined __IBMC__
/* String literals below are in ASCII, not EBCDIC. */
- Re: z/OS, iconv, and charset aliases,
Bruno Haible <=