texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Common.pm (output_files_open_out): d


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Common.pm (output_files_open_out): do not set explicitly the :utf8 layer with binmode as it is documented that binmode puts :utf8 on top of :encoding. Also do not set the :bytes layer, it is documented to be incorrect with :encoding.
Date: Wed, 14 Sep 2022 02:32:48 -0400

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 3ffa26c456 * tp/Texinfo/Common.pm (output_files_open_out): do not set 
explicitly the :utf8 layer with binmode  as it is documented that binmode puts 
:utf8 on top of :encoding.  Also do not set the :bytes layer, it is documented 
to be incorrect with :encoding.
3ffa26c456 is described below

commit 3ffa26c456b827b85f42db52fa816cf4436b9535
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Sep 14 08:32:36 2022 +0200

    * tp/Texinfo/Common.pm (output_files_open_out): do not set
    explicitly the :utf8 layer with binmode  as it is documented that
    binmode puts :utf8 on top of :encoding.  Also do not set the
    :bytes layer, it is documented to be incorrect with :encoding.
    
    * tp/Texinfo/Common.pm, configure.ac: require perl above 5.8.1
    to have binmode documented as putting :utf8 on top of :encoding.
---
 ChangeLog            | 10 ++++++++++
 configure.ac         |  4 ++--
 tp/Texinfo/Common.pm | 24 ++++++++++--------------
 3 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ed60b44bf1..405e6b39c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-09-14  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Common.pm (output_files_open_out): do not set
+       explicitly the :utf8 layer with binmode  as it is documented that
+       binmode puts :utf8 on top of :encoding.  Also do not set the
+       :bytes layer, it is documented to be incorrect with :encoding.
+
+       * tp/Texinfo/Common.pm, configure.ac: require perl above 5.8.1
+       to have binmode documented as putting :utf8 on top of :encoding.
+
 2022-09-14  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Common.pm (locate_include_file): avoid a call to
diff --git a/configure.ac b/configure.ac
index 6a5b46dd6b..98c5adfc4a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,14 +61,14 @@ AC_ARG_VAR([PERL_EXT_LDFLAGS], [Linker flags for a Perl 
extension])
 AC_ARG_VAR([PERL_EXT_CC], [Compiler for a Perl extension])
 
 AC_MSG_CHECKING([Perl version and modules])
-if $PERL -e "use 5.007_003; use Encode; use Data::Dumper" >/dev/null 2>&1; then
+if $PERL -e "use 5.008_001; use Encode; use Data::Dumper" >/dev/null 2>&1; then
   perl_version_requirement='yes'
 else
   perl_version_requirement='no'
 fi
 AC_MSG_RESULT($perl_version_requirement)
 if test z"$perl_version_requirement" = 'zno' ; then
-  AC_MSG_ERROR([perl >= 5.7.3 with Encode and Data::Dumper required by 
Texinfo.])
+  AC_MSG_ERROR([perl >= 5.8.1 with Encode and Data::Dumper required by 
Texinfo.])
 fi
 
 
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 72c93ca934..e9196ce9bc 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -23,7 +23,8 @@ package Texinfo::Common;
 use strict;
 
 # for unicode/layer support in binmode
-use 5.006;
+# for binmode documented as pushing :utf8 on top of :encoding
+use 5.008001;
 
 # to determine the null file
 use Config;
@@ -1219,11 +1220,13 @@ sub locate_init_file($$$)
 # internal API to open, set encoding and register files.
 # In general $SELF is stored as $converter->{'output_files'}
 # and should be accessed through $converter->output_files_information();
+#
 # All the opened files are registered, except for stdout,
 # and the closing of files should be registered too with
 # output_files_register_closed() below.  This makes possible to
 # unlink all the opened files and close the files not already
 # closed.
+#
 # $FILE_PATH is the file path, it should be a binary string.
 # If $USE_BINMODE is set, call binmode() to set binary mode.
 # $OUTPUT_ENCODING argument overrides the output encoding.
@@ -1257,18 +1260,11 @@ sub output_files_open_out($$$;$$)
     my $error_message = $!;
     return undef, $error_message;
   }
-  # We run binmode to turn off outputting LF as CR LF under MS-Windows,
-  # so that Info tag tables will have correct offsets.  This must be done
-  # before setting the encoding filters with binmode.
+  # If $use_binmode is true, we run binmode to turn off outputting LF as CR LF
+  # under MS-Windows, so that Info tag tables will have correct offsets.  This
+  # must be done before setting the encoding filters with binmode.
   binmode($filehandle) if $use_binmode;
   if ($encoding) {
-    if ($encoding eq 'utf8'
-        or $encoding eq 'utf-8'
-        or $encoding eq 'utf-8-strict') {
-      binmode($filehandle, ':utf8');
-    } else { # FIXME also right for shiftijs or similar encodings?
-      binmode($filehandle, ':bytes');
-    }
     binmode($filehandle, ":encoding($encoding)");
   }
   if ($self) {
@@ -1278,9 +1274,9 @@ sub output_files_open_out($$$;$$)
   return $filehandle, undef;
 }
 
-# see the description of $SELF in output_files_open_out
-# comment above.
-# $FILE is the file path, it should be a binary string.
+# see the description of $SELF in comment above output_files_open_out.
+#
+# $FILE_PATH is the file path, it should be a binary string.
 sub output_files_register_closed($$)
 {
   my $self = shift;



reply via email to

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