texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: @include file name encoding


From: Gavin D. Smith
Subject: branch master updated: @include file name encoding
Date: Sun, 20 Feb 2022 07:45:11 -0500

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

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new e11835b62d @include file name encoding
e11835b62d is described below

commit e11835b62d8f3d43c608013d21683c72e9a54cc3
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Feb 20 12:45:02 2022 +0000

    @include file name encoding
    
    * tp/Texinfo/Common.pm (locate_include_file):
    Call utf8::encode on the argument, as otherwise an include
    file may not be found.
    Report from Gaël Bonithon <trash.paradise@protonmail.com> of
    failure building under non-ASCII directory name.
---
 ChangeLog            | 10 ++++++++++
 tp/Texinfo/Common.pm | 16 ++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index c75933dda4..e51f333601 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-02-20  Gavin Smith  <gavinsmith0123@gmail.com>
+
+       @include file name encoding
+
+       * tp/Texinfo/Common.pm (locate_include_file):
+       Call utf8::encode on the argument, as otherwise an include
+       file may not be found.
+       Report from Gaël Bonithon <trash.paradise@protonmail.com> of
+       failure building under non-ASCII directory name.
+
 2022-02-19  Patrice Dumas  <pertusus@free.fr>
 
        * configure.ac (TEXINFO_DTD_VERSION), util/texinfo.dtd:
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 29dbf3c8c3..00d15aa693 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -1507,6 +1507,22 @@ sub locate_include_file($$)
   my $text = shift;
   my $file;
 
+  # Reverse the decoding of the file name from UTF-8.  When dealing
+  # with file names, we want Perl strings representing sequences of bytes,
+  # not UTF-8 codepoints.
+  #     This is necessary even if the name of the included file is purely
+  # ASCII, as the name of the directory it is located within may contain
+  # non-ASCII characters.
+  #   Otherwise, the -e operator and similar may not work correctly.
+  #
+  if ($configuration_information) {
+    my $info = Texinfo::Parser::global_information($configuration_information);
+    my $encoding = $info->{'input_perl_encoding'};
+    if ($encoding and ($encoding eq 'utf-8' or $encoding eq 'utf-8-strict')) {
+      utf8::encode($text);
+    }
+  }
+
   my $ignore_include_directories = 0;
 
   my ($volume, $directories, $filename) = File::Spec->splitpath($text);



reply via email to

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