Re: portability issues with unicodeio

Bruno Haible <[email protected]>
Newsgroups gmane.comp.lib.gnulib.bugs,gmane.comp.parsers.bison.bugs
Message-ID <2526281.JFeZiGrfq5@omega>
> 	* tests/test-unicodeio.c (main): In the "C" locale, expect either the
> 	UTF-8 output or the specified fallback.

Now that we have a unit test, I see that the test fails on NetBSD 9.0. This
patch fixes it.


2020-07-10  Bruno Haible  <[email protected]>

	unicodeio: Fix wrong result on NetBSD.
	* lib/unicodeio.c (unicode_to_mb): Handle question mark fallback
	characters also on NetBSD.

diff --git a/lib/unicodeio.c b/lib/unicodeio.c
index 81fe0dd..b616e3d 100644
--- a/lib/unicodeio.c
+++ b/lib/unicodeio.c
@@ -134,9 +134,10 @@ unicode_to_mb (unsigned int code,
 # if !defined _LIBICONV_VERSION && (defined sgi || defined __sgi)
           || (res > 0 && code != 0 && outptr - outbuf == 1 && *outbuf == '\0')
 # endif
-          /* Solaris 11 iconv() inserts a '?' if it cannot convert. */
-# if !defined _LIBICONV_VERSION && defined __sun
-          || (res > 0 && code != 0 && outptr - outbuf == 1 && *outbuf == '?')
+          /* NetBSD iconv() and Solaris 11 iconv() insert a '?' if they cannot
+             convert.  */
+# if !defined _LIBICONV_VERSION && (defined __NetBSD__ || defined __sun)
+          || (res > 0 && outptr - outbuf == 1 && *outbuf == '?')
 # endif
          )
         return failure (code, NULL, callback_arg);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.