bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Subject: Improve support of Citrus/FreeBSD iconv
Date: Wed, 14 Feb 2024 23:22:11 +0100	[thread overview]
Message-ID: <12057854.ag9G3TJQzC@nimes> (raw)

FreeBSD nowadays has an iconv implementation that supports transliteration,
with the same iconv_open interface (add "//TRANSLIT" to the end of the target
encoding argument) as glibc and GNU libiconv, and with the same iconvctl
interface as GNU libiconv.

This patch enable support for it in the Gnulib modules.

I'm not enabling the similar support in Solaris 11 iconv, since it takes a
different code to enable it:
  1. iconvctl ICONV_GET_CONVERSION_BEHAVIOR
  2. add ICONV_CONV_NON_IDENTICAL_TRANSLITERATE
  3. iconvctl ICONV_SET_CONVERSION_BEHAVIOR.


2024-02-14  Bruno Haible  <bruno@clisp.org>

	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/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;





                 reply	other threads:[~2024-02-14 22:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12057854.ag9G3TJQzC@nimes \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).