From e649a3bbd4be8a6af0db7275f6600bb5bed1ffb7 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 7 Dec 2020 21:13:54 +0100 Subject: [PATCH] unicodeio: Fix wrong result on FreeBSD. * lib/unicodeio.c (unicode_to_mb): Handle question mark fallback characters on all platforms. --- ChangeLog | 6 ++++++ lib/unicodeio.c | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index da760380c1..5992c891d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2020-12-07 Bruno Haible + + 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 get-rusage-data tests: Avoid test failure on FreeBSD/x86_64. diff --git a/lib/unicodeio.c b/lib/unicodeio.c index d587a278d6..3d7a6029bc 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. */ -- 2.39.5