bug-gnulib
[Top][All Lists]
Advanced

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

Re: new module 'c32rtomb'


From: Bruno Haible
Subject: Re: new module 'c32rtomb'
Date: Tue, 21 Jan 2020 02:00:35 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-171-generic; KDE/5.18.0; x86_64; ; )

I wrote:
> On FreeBSD 12 and Solaris 11.4, the
> two encodings are different. The FreeBSD 12 wchar_t encoding is apparently
> based on ISO 2022 (very old).
> 
> The fix is to use mbrtoc32() on platforms where this is possible, namely
> on FreeBSD.

Actually, FreeBSD has a similar bug as Solaris 11.4. Therefore it is better to
NOT use the system's mbrtoc32() on FreeBSD 12.


2020-01-20  Bruno Haible  <address@hidden>

        mbrtoc32: Add note about FreeBSD 12.
        * m4/mbrtoc32.m4 (gl_MBRTOC32_SANITYCHECK): Guess no also on FreeBSD.
        * doc/posix-functions/mbrtoc32.texi: Mention that FreeBSD 12 is also
        affected.

diff --git a/doc/posix-functions/mbrtoc32.texi 
b/doc/posix-functions/mbrtoc32.texi
index 9789bef..3151a09 100644
--- a/doc/posix-functions/mbrtoc32.texi
+++ b/doc/posix-functions/mbrtoc32.texi
@@ -20,7 +20,7 @@ glibc 2.19.
 @item
 This function does not recognize multibyte sequences that @code{mbrtowc}
 recognizes on some platforms:
-Solaris 11.4, mingw, MSVC 14.
+FreeBSD 12, Solaris 11.4, mingw, MSVC 14.
 @end itemize
 
 Portability problems not fixed by Gnulib:
diff --git a/m4/mbrtoc32.m4 b/m4/mbrtoc32.m4
index 3dee900..a5dc51a 100644
--- a/m4/mbrtoc32.m4
+++ b/m4/mbrtoc32.m4
@@ -1,4 +1,4 @@
-# mbrtoc32.m4 serial 2
+# mbrtoc32.m4 serial 3
 dnl Copyright (C) 2014-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -136,10 +136,14 @@ AC_DEFUN([gl_MBRTOC32_SANITYCHECK],
         dnl is present.
 changequote(,)dnl
         case "$host_os" in
-                             # Guess no on Solaris, native Windows.
-          solaris* | mingw*) gl_cv_func_mbrtoc32_sanitycheck="guessing no" ;;
-                             # Guess yes otherwise.
-          *)                 gl_cv_func_mbrtoc32_sanitycheck="guessing yes" ;;
+          # Guess no on FreeBSD, Solaris, native Windows.
+          freebsd* | solaris* | mingw*)
+            gl_cv_func_mbrtoc32_sanitycheck="guessing no"
+            ;;
+          # Guess yes otherwise.
+          *)
+            gl_cv_func_mbrtoc32_sanitycheck="guessing yes"
+            ;;
         esac
 changequote([,])dnl
         if test $LOCALE_FR != none || test $LOCALE_ZH_CN != none; then
@@ -176,8 +180,8 @@ int main ()
             result |= 1;
         }
     }
-  /* This fails on Solaris 11.4:
-     mbrtoc32 returns (size_t)-1.
+  /* This fails on FreeBSD 12 and Solaris 11.4:
+     mbrtoc32 returns (size_t)-2 or (size_t)-1.
      mbrtowc returns 4 (correct).  */
   if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
     {




reply via email to

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