Subject: bug#65305: 29.1; archive-mode can not handle subfile names encoded with utf-8

From: Eli Zaretskii <[email-masked]>
Date: Wed, 16 Aug 2023 15:38:27 +0300

> From: [email-masked]
> Cc: [email-masked]
> Date: Wed, 16 Aug 2023 12:47:14 +0900
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >> There is a bit flag indicating that the subfile name is encoded with
> >> utf-8. Bytes 6-7 in local file header or bytes 8-9 in central directory
> >> header are general purpose bit flag. And bit 11 of the flag represents
> >> file encoding flag(1 for utf-8 encoding).
> >
> > Thanks, please try the patch below.  If it gives good results, I will
> > install it.
> 
> The patch works to list entries, and the contents can be extracted with
> 7z.exe. unzip.exe does not work well.

Thanks, I installed the patch on the emacs-29 branch.  I'm not
surprised that unzip.exe cannot extract such files, and I think it
works for you with 7z.exe by sheer luck: Windows transparently
converts non-ASCII characters to the system codepage when it invokes
programs via the "narrow" APIs, so it could mangle the UTF-8 encoded
file name into something unrecognizable.

> I tried the settings below, but rewriting entries does not work.
> (archive-zip-* variables' values are default if archive-7z-program is set
> and zip.exe/unzip.exe are non-existent)
> 
> (setq archive-7z-program "c:/Program Files/7-Zip/7z.exe"
>       archive-zip-extract '("c:/Program Files/7-Zip/7z.exe" "x" "-so")
>       archive-zip-expunge '("c:/Program Files/7-Zip/7z.exe" "d")
>       archive-zip-update  '("c:/Program Files/7-Zip/7z.exe" "u")
>       archive-zip-update-case archive-zip-update)
> 
> It is because update command needs "-si" option followed by an entry
> name. It should be one argument like (format "-si%s" name). 

Sorry, I don't understand: is this the same problem, or is this an
additional problem?  For example, does rewriting entries work with
ASCII file names?

If this is a separate problem, I prefer that you submit a separate bug
report with all the pertinent details.

Thanks.