unicodeio: Fix wrong result on FreeBSD.
authorBruno Haible <bruno@clisp.org>
Mon, 7 Dec 2020 20:13:54 +0000 (21:13 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 7 Dec 2020 20:13:54 +0000 (21:13 +0100)
* lib/unicodeio.c (unicode_to_mb): Handle question mark fallback
characters on all platforms.

ChangeLog
lib/unicodeio.c

index da760380c1fca635bca47c9fadd702ae7cbe291d..5992c891d9f04001c73ee5464dbaaa06bc52da00 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-12-07  Bruno Haible  <bruno@clisp.org>
+
+       unicodeio: Fix wrong result on FreeBSD.
+       * lib/unicodeio.c (unicode_to_mb): Handle question mark fallback
+       characters on all platforms.
+
 2020-12-07  Bruno Haible  <bruno@clisp.org>
 
        get-rusage-data tests: Avoid test failure on FreeBSD/x86_64.
index d587a278d6fe0a9ba2f6e68041d5af1d342e0538..3d7a6029bc42b97d51164871ee6032be31618b39 100644 (file)
@@ -142,9 +142,9 @@ unicode_to_mb (unsigned int code,
 # if !defined _LIBICONV_VERSION && (defined sgi || defined __sgi)
           || (res > 0 && code != 0 && outptr - outbuf == 1 && *outbuf == '\0')
 # endif
-          /* NetBSD iconv() and Solaris 11 iconv() insert a '?' if they cannot
-             convert.  */
-# if !defined _LIBICONV_VERSION && (defined __NetBSD__ || defined __sun)
+          /* FreeBSD iconv(), NetBSD iconv(), and Solaris 11 iconv() insert
+             a '?' if they cannot convert.  */
+# if !defined _LIBICONV_VERSION
           || (res > 0 && outptr - outbuf == 1 && *outbuf == '?')
 # endif
           /* musl libc iconv() inserts a '*' if it cannot convert.  */