]> Savannah Git Hosting - gnulib.git/commitdiff
unicodeio: Add comment.
authorBruno Haible <bruno@clisp.org>
Thu, 30 Jul 2020 18:20:57 +0000 (20:20 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 30 Jul 2020 18:20:57 +0000 (20:20 +0200)
* lib/unicodeio.c (unicode_to_mb): Clarify why the code distinguishes
different iconv behaviours.

ChangeLog
lib/unicodeio.c

index cf82ab25488db08b861b17a224646131cd9e7dbd..95851778c1b83aab0877ef27d8aa02cf26c72253 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-07-30  Bruno Haible  <bruno@clisp.org>
+
+       unicodeio: Add comment.
+       * lib/unicodeio.c (unicode_to_mb): Clarify why the code distinguishes
+       different iconv behaviours.
+
 2020-07-30  Paul Eggert  <eggert@cs.ucla.edu>
 
        Work around some Oracle Studio attribute bugs
index 7d5e1fbcd282dcbd11c1c69fb71b4ca67a188bf1..d587a278d6fe0a9ba2f6e68041d5af1d342e0538 100644 (file)
@@ -129,6 +129,14 @@ unicode_to_mb (unsigned int code,
       res = iconv (utf8_to_local,
                    (ICONV_CONST char **)&inptr, &inbytesleft,
                    &outptr, &outbytesleft);
+      /* Analyze what iconv() actually did and distinguish replacements
+         that are OK (no need to invoke the FAILURE callback), such as
+           - replacing GREEK SMALL LETTER MU with MICRO SIGN, or
+           - replacing FULLWIDTH COLON with ':', or
+           - replacing a Unicode TAG character (U+E00xx) with an empty string,
+         from replacements that are worse than the FAILURE callback, such as
+           - replacing 'รง' with '?' (NetBSD, Solaris 11) or '*' (musl) or
+             NUL (IRIX).  */
       if (inbytesleft > 0 || res == (size_t)(-1)
           /* Irix iconv() inserts a NUL byte if it cannot convert.  */
 # if !defined _LIBICONV_VERSION && (defined sgi || defined __sgi)