emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 205d87cdca0: Fix unpacking ZIP archives on MS-Windows


From: Eli Zaretskii
Subject: emacs-29 205d87cdca0: Fix unpacking ZIP archives on MS-Windows
Date: Wed, 16 Aug 2023 08:34:48 -0400 (EDT)

branch: emacs-29
commit 205d87cdca09c648da4fc8ec622c135e1655a08b
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix unpacking ZIP archives on MS-Windows
    
    * lisp/arc-mode.el (archive-zip-summarize): Decode file names as
    UTF-8 when bit 11 of flags is set, even on MS-Windows.
    (Bug#65305)
---
 lisp/arc-mode.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index 5e696c091b2..05a71fb4c5a 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -1990,6 +1990,7 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
     (setq p (+ p (point-min)))
     (while (string= "PK\001\002" (buffer-substring p (+ p 4)))
       (let* ((creator (get-byte (+ p 5)))
+             (gpflags (archive-l-e (+ p 8) 2))
             ;; (method  (archive-l-e (+ p 10) 2))
              (modtime (archive-l-e (+ p 12) 2))
              (moddate (archive-l-e (+ p 14) 2))
@@ -2001,7 +2002,12 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
              (efnname (let ((str (buffer-substring (+ p 46) (+ p 46 fnlen))))
                        (decode-coding-string
                         str
-                         (or (if (and w32-fname-encoding
+                         ;; Bit 11 of general purpose bit flags (bytes
+                         ;; 8-9) of Central Directory: 1 means UTF-8
+                         ;; encoded file names.
+                         (or (if (/= 0 (logand gpflags #x0800))
+                                 'utf-8-unix)
+                             (if (and w32-fname-encoding
                                       (memq creator
                                             ;; This should be just 10 and
                                             ;; 14, but InfoZip uses 0 and



reply via email to

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