bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

unicodeio: Fix wrong result on FreeBSD


From: Bruno Haible
Subject: unicodeio: Fix wrong result on FreeBSD
Date: Mon, 07 Dec 2020 21:14:28 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-193-generic; KDE/5.18.0; x86_64; ; )

On FreeBSD 12.0, I'm seeing this test failure:

  ../../gltests/test-unicodeio.c:67: assertion 'strcmp (result, 
TEST_CODE_AS_UTF8) == 0' failed
  Abort trap (core dumped)
  FAIL test-unicodeio1.sh (exit status: 134)

This patch fixes it, by generalizing the patch that I added for NetBSD
on 2020-07-10.


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.

diff --git a/lib/unicodeio.c b/lib/unicodeio.c
index d587a27..3d7a602 100644
--- a/lib/unicodeio.c
+++ b/lib/unicodeio.c
@@ -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.  */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]