bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* Improve support of Citrus/FreeBSD iconv
@ 2024-02-14 22:22 Bruno Haible
  0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2024-02-14 22:22 UTC (permalink / raw)
  To: bug-gnulib

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;





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-14 22:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-14 22:22 Improve support of Citrus/FreeBSD iconv Bruno Haible

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).