From: Bruno Haible Date: Wed, 14 Feb 2024 22:16:15 +0000 (+0100) Subject: Improve support of Citrus/FreeBSD iconv. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=855cc5c6216bce7b6cd03980c61757e73906839e;p=gnulib.git Improve support of Citrus/FreeBSD iconv. * lib/striconveh.c (iconveh_open): Use //TRANSLIT with all iconv implementations that support it. * lib/striconveha.c (mem_iconveha, str_iconveha): Likewise. * lib/propername.c (proper_name_utf8): Likewise. --- diff --git a/ChangeLog b/ChangeLog index c35253d903..7b5b1a98b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2024-02-14 Bruno Haible + + Improve support of Citrus/FreeBSD iconv. + * lib/striconveh.c (iconveh_open): Use //TRANSLIT with all iconv + implementations that support it. + * lib/striconveha.c (mem_iconveha, str_iconveha): Likewise. + * lib/propername.c (proper_name_utf8): Likewise. + 2024-02-14 Bruno Haible isnan: Fix compilation error in C++ mode on macOS 14.4 / Xcode 15.2. diff --git a/lib/propername.c b/lib/propername.c index a4d4f72cdf..d5b52a2c11 100644 --- a/lib/propername.c +++ b/lib/propername.c @@ -228,7 +228,8 @@ proper_name_utf8 (const char *name_ascii, const char *name_utf8) # if (((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2) \ && !defined __UCLIBC__) \ - || _LIBICONV_VERSION >= 0x0105 + || _LIBICONV_VERSION >= 0x0105 \ + || defined ICONV_SET_TRANSLITERATE { char *converted_translit; diff --git a/lib/striconveh.c b/lib/striconveh.c index bf4a2e7b54..43cc3e11a4 100644 --- a/lib/striconveh.c +++ b/lib/striconveh.c @@ -81,7 +81,8 @@ iconveh_open (const char *to_codeset, const char *from_codeset, iconveh_t *cdp) if (STRCASEEQ (to_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0) # if (((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2) \ && !defined __UCLIBC__) \ - || _LIBICONV_VERSION >= 0x0105 + || _LIBICONV_VERSION >= 0x0105 \ + || defined ICONV_SET_TRANSLITERATE || c_strcasecmp (to_codeset, "UTF-8//TRANSLIT") == 0 # endif ) diff --git a/lib/striconveha.c b/lib/striconveha.c index 19b6700a0e..08008d8bdc 100644 --- a/lib/striconveha.c +++ b/lib/striconveha.c @@ -219,11 +219,12 @@ mem_iconveha (const char *src, size_t srclen, return 0; } - /* When using GNU libc >= 2.2 or GNU libiconv >= 1.5, - we want to use transliteration. */ + /* When using GNU libc >= 2.2 or GNU libiconv >= 1.5 or Citrus/FreeBSD/macOS + iconv, we want to use transliteration. */ #if (((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2) \ && !defined __UCLIBC__) \ - || _LIBICONV_VERSION >= 0x0105 + || _LIBICONV_VERSION >= 0x0105 \ + || defined ICONV_SET_TRANSLITERATE if (transliterate) { int retval; @@ -326,11 +327,12 @@ str_iconveha (const char *src, return result; } - /* When using GNU libc >= 2.2 or GNU libiconv >= 1.5, - we want to use transliteration. */ + /* When using GNU libc >= 2.2 or GNU libiconv >= 1.5 or Citrus/FreeBSD/macOS + iconv, we want to use transliteration. */ #if (((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2) \ && !defined __UCLIBC__) \ - || _LIBICONV_VERSION >= 0x0105 + || _LIBICONV_VERSION >= 0x0105 \ + || defined ICONV_SET_TRANSLITERATE if (transliterate) { char *result;