texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: Recode filenames into input encoding


From: Gavin D. Smith
Subject: branch master updated: Recode filenames into input encoding
Date: Wed, 23 Feb 2022 13:54:18 -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 e58d50d0e8 Recode filenames into input encoding
e58d50d0e8 is described below

commit e58d50d0e819f255408b6bc4137c0d6b56acdaf2
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Wed Feb 23 18:54:04 2022 +0000

    Recode filenames into input encoding
    
    * tp/Texinfo/Common.pm (locale_include_file): Recode
    the filename into the input encoding even if it is not UTF-8.
---
 ChangeLog            |  7 +++++++
 tp/Texinfo/Common.pm | 14 +++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5b9de52c1a..eb4ae89f63 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-02-23  Gavin Smith  <gavinsmith0123@gmail.com>
+
+       Recode filenames into input encoding
+
+       * tp/Texinfo/Common.pm (locale_include_file): Recode
+       the filename into the input encoding even if it is not UTF-8.
+
 2022-02-23  Gavin Smith  <gavinsmith0123@gmail.com>
 
        Get errors from XS code without using eval
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index d3f69efd87..5e6fcfb597 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -1511,9 +1511,9 @@ 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.
+  # Reverse the decoding of the file name from the input encoding.  When
+  # dealing with file names, we want Perl strings representing sequences of
+  # bytes, not Unicode 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.
@@ -1522,8 +1522,12 @@ sub locate_include_file($$)
   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);
+    if ($encoding) {
+      if ($encoding eq 'utf-8' or $encoding eq 'utf-8-strict') {
+        utf8::encode($text);
+      } else {
+        $text = Encode::encode($encoding, $text);
+      }
     }
   }
 



reply via email to

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