texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: Fix latex2html init file under Latin-1 locale


From: Gavin D. Smith
Subject: branch master updated: Fix latex2html init file under Latin-1 locale
Date: Sun, 06 Mar 2022 08:33:16 -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 fb384801bf Fix latex2html init file under Latin-1 locale
fb384801bf is described below

commit fb384801bf08aa14cdff6465e44eb002e0535d9e
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Mar 6 13:32:41 2022 +0000

    Fix latex2html init file under Latin-1 locale
    
    * tp/init/latex2html.pm (l2h_change_image_file_name):
    Hardcode the use of UTF-8 to encode image file names, as the
    calling code in l2h_init_from_html set a ':utf8' filter on the
    file the file names were taken from.  Call File::Spec->catpath
    on already-encoded strings rather than encoding afterwards.
---
 ChangeLog             | 10 ++++++++++
 tp/init/latex2html.pm | 13 ++++++++-----
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 81cbbbea3a..4888aa4f42 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-03-06  Gavin Smith  <gavinsmith0123@gmail.com>
+
+       Fix latex2html init file under Latin-1 locale
+
+       * tp/init/latex2html.pm (l2h_change_image_file_name):
+       Hardcode the use of UTF-8 to encode image file names, as the
+       calling code in l2h_init_from_html set a ':utf8' filter on the
+       file the file names were taken from.  Call File::Spec->catpath
+       on already-encoded strings rather than encoding afterwards.
+
 2022-03-06  Patrice Dumas  <pertusus@free.fr>
 
        Document that some functions are getting or returning binary strings
diff --git a/tp/init/latex2html.pm b/tp/init/latex2html.pm
index 8324da8931..4d0974b39b 100644
--- a/tp/init/latex2html.pm
+++ b/tp/init/latex2html.pm
@@ -461,22 +461,25 @@ sub l2h_change_image_file_names($$)
         }
         $image_count++;
       }
-      my $file_src
-        = File::Spec->catpath($docu_volume, $docu_directories, $src);
-      my ($encoded_file_src, $src_file_encoding)
-        = $self->encoded_output_file_name($file_src);
+      my $encoded_src = Encode::encode('UTF-8', $src);
+      my ($encoded_dir, $encoded_dir_encoding)
+        = $self->encoded_output_file_name($docu_directories);
+      my $encoded_file_src
+        = File::Spec->catpath($docu_volume, $encoded_dir, $encoded_src);
+
       $dest = "${docu_name}_${image_count}$ext";
       my $file_dest
         = File::Spec->catpath($docu_volume, $docu_directories, $dest);
       my ($encoded_file_dest, $dest_file_encoding)
         = $self->encoded_output_file_name($file_dest);
+
       if ($debug) {
         copy($encoded_file_src, $encoded_file_dest);
       } else {
         if (!rename($encoded_file_src, $encoded_file_dest)) {
           $self->document_warn($self,
                  sprintf(__("l2h: rename %s as %s failed: %s"),
-                                       $file_src, $file_dest, $!));
+                                 $encoded_file_src, $encoded_file_dest, $!));
         }
       }
       $l2h_img{$src} = $dest;



reply via email to

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