简体   繁体   中英

How to recursively zip utf-8 files and folders from a batch file?

I have a folder named "Attachments2". I'm working in windows 7 and am using zip.exe downloaded from cygwin to zip this folder.

In this folder there are folders and files which have Hebrew characters in their names and content (in the files' content that is).

This is a snapshot of how the folder looks like in the file system:

在此处输入图片说明

When trying the following :

zip.exe -r results.zip Attechments2

I get the following:

在此处输入图片说明

The file contents are as the origin.

Please help.

Regrards, Omer.

Windows's ZIP file shell extension (“Compressed Folders”) doesn't support Unicode filenames. Instead it takes the byte filename string and interprets it using a locale-specific legacy encoding (which varies from machine to machine and is never a UTF).

It looks like you've got some further mangling in the zipping-up process too as it doesn't look like a straight UTF-8 misinterpretation; you could get a better idea of what the filenames are in the ZIP by using another tool that does support Unicode to open it (eg 7zip). But the point is likely moot: if you are expecting the consumers of the ZIP file to be Windows users, the only safe filename characters are ASCII.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM