How to create ZIP files with specific encoding - windows

On my Linux server I have some files with accented names (test-éàïù.zip).
When I add them to a new ZIP file using 7zip command-line tool, the charset/encoding information is not saved and when opened on a Windows computer, the archive does not correctly display filenames.
I know that 7zip creates Zip V1.0 archives, not 2.0. Maybe the charset is limited to MSDos charset ?
How could I specify an encoding using 7zip or another zip tool, in order to get portable archives?

This is a superuser question, BUT...
ZIP uses a default codepage of IBM437. There is the possibility to use UTF-8, but not all zip tools and libraries support that. Some zip tools will do arbitrary code pages, even though the zip spec allows only IBM437 or UTF-8. I think WinRar is one such tool.
DotNetZip does encoding. It will do UTF-8 or an arbitrary code page. if you're writing an app, there is a .NET library. If you are running from a script, there are command line tools. Either way, DotNetZip requires .NET. You will need Mono to run it on Linux.
example for the command line:
zipit.exe Olivier.zip -cp 860 test-éàïù.txt
(to use the 860 codepage) I'm not sure that Windows Explorer correctly handles zipfiles with alternate encoding for the filenames within the zips.
See How to zip specified folders with Command Line for more info on that zipit.exe tool.

Create a ZIP file using specified code page:
7z a -mcp=<code_page> -tzip <archive_name> <file_names>...
Extract files from a ZIP file using specified code page:
7z x -mcp=<code_page> <archive_name>

I know that 7zip creates Zip V1.0 archives, not 2.0.
I couldn't work out how to use 7zip to create a zip v1.0 archive.
You can create version 1 ZIP archives using Info-Zip’s zip 1.1, which is still available (download from the FTP http://infozip.sourceforge.net/Zip.html#Downloads). You’ll need to build it from source (make sysv on a Linux system); then you’ll be able to use the newly-built zip to create old-format archives:
]# ./zip filename.zip file1 file2 file3
]# file filename.zip
]# filename.zip: Zip archive data, at least v1.0 to extract

Related

UNIX executable file downloaded from internet not set as executable automatically in Mac

I have a UNIX executable file which could be executed by just clicking it. I uploaded it to a cloud service, and then downloaded it on another Mac computer. Now this Mac doesn't recognise it as an executable file anymore. So I have to use the chmod +x command. Is there any way to keep the executable nature of the file intact, upon upload and download from the internet?
I could use the chmod +x command to make the downloaded file executable. But it was originally executable. I don't understand why this mode is changed upon upload and download from the internet.
Different cloud services will have different behavior with respect to preserving the Unix file modes and ACLs. When uploaded to a cloud service, the files may be stored on a different type of filesystem or may not be stored as files at all.
On my mac I copied a file to iCloud Drive and the executable mode was preserved. Microsoft OneDrive also preserved the executable mode. Both iCloud Drive and OneDrive integrate with Finder.
You may consider using tar or gzip to create an archive file containing your executable. The archive format will preserve the file modes and the archive file can be stored on any cloud service.

How to how to install poppler from the .tar file downloaded from poppler official site

There is no useful information on the site describing how to install the file .I have tried extracting the .tar file, installing through command prompt . there is no information available on the web.OS used is windows 11. Its for a project to extract data from images, using OCR. Poppler is used for getting page numbers of the pdf file which will be converted to an image file later in the process."https://poppler.freedesktop.org/" is the site from which I downloaded the file.Is this the right site.Any answer is helpful.Thank you
Poppler source is constantly updated, and thus common for Linux and Mac users to build or brew on demand. It is not much different when using Programming Suites like Python, Ruby etc.
Windows users expect one exe, but the poppler utils were built as a spin off from non-commercial licensed xpdf and for personal 32 bit users that is often simpler.
I have given examples for how simple that xpdf unpacking can be for one exe in several posts such as https://stackoverflow.com/a/68697144/10802527 (how to scan a file list, not used here) and https://stackoverflow.com/a/73123537/10802527 (how to use to run a single file) and
https://stackoverflow.com/a/73437398/10802527 (running one exe on demand)
Poppler prebuilt binaries are available as 64bit only so the first step after making a work directory is download latest version from https://github.com/oschwartz10612/poppler-windows using most current
https://github.com/oschwartz10612/poppler-windows/releases/download/v22.04.0-0/Release-22.04.0-0.zip and save to the working folder, then you can use right click Extract All... OR
tar -m -xf Release-22.04.0-0.zip to unpack in that folder so it should look like in the binary folder
Now the exe files are in a subdirectory and when using those it is best if that folder is included on the path environment.
RESIST any means to add using set or worse setx simply add folder via system gui, note in some cases after saving the setting it may need log off and log on to stick and in very rare cases even a reboot/restart.

Why does boost have different downloads for windows and linux?

This might be a stupid question, but if boost is meant to be cross-platform, why does each platform need its own version?
If I want to package a (header-only) subset of boost as a dependency with my project, do I need to include both windows and linux versions?
Line endings.
Windows IDEs typically prefer to edit all files in CR+LF (windows) line-ends.
All other platforms use LF (Unix) style line ends.
From old documentation:
.zip file
The .zip format is widely supported by both free decoders and
commercial compress/archive utilities. If you don't already have a
.zip file decoder, download one from the Info-ZIP web site, which
supplies versions for many operating systems. Text file line endings
in the .zip file are as supplied by each library developer. This
works fine for Windows, but not for Unix/Linux. The .tar.gz and
.tar.bz2 files supply Unix/Linux friendly line endings.
.tar.gz and .tar.bz2 files
The .tar.gz format is widely supported on Unix/Linux platforms. Some
Windows compress/archive utilities can read the format as well.
Because the gzip format compresses the archive as a single file rather
than compressing each file individually, the .tar.gz file is smaller
that the .zip file.
The .tar.bz2 format is becoming widely available on Unix/Linux
platforms and is built into many tar utilities. This format differs
for the .tar.gz format in the compression used, which is considerably
better and therefore creates smaller files.
Text file line endings in the .tar.gz and .tar.bz2 files have been
converted to newlines for ease of use on Unix/Linux platforms.

public folder on redmine doesn't recognize binary files

I have put a binary file (.apk) on redmine/public folder but when I try to download that file I only get the text version of that file as text.
How to change that behavior to direct download?
You need to navigate to the httputils.rb file (it's wherever webrick is installed) and add this line to the list of MIME types:
application/vnd.android.package-archive apk
If that seems like a lot of trouble and you're not trying to do anything fancy with this download (e.g. download it directly from an android phone and install it), you can always wrap it in a .zip and call it a day. Zip files will download automatically.

Alter Windows install program

I have a setupOriginal.exe file, and I would need to update it to had some features.
I can unzip it with 7Zip and it contains a hierarchy like that:
Autorun.inf
setup.exe
setup.exe.manifest
Directory\main.msi
As far as I know, the file setupOriginal.exe is some kind of auto extractable file since I can unzip it.
Once unzipped, I can modify the main.msi file.
But, I am not able to rebuild the packed setup.exe into one file setupAltered.exe which would run the same way as before, and contain the hierarchy:
Autorun.inf
setup.exe
setup.exe.manifest
Directory\mainAltered.msi
I tried:
to build self extractable with 7Zip and WinZip but there is an intermediate unzip step
to update setupOriginal.exe inline and save directly without unzipping in WinZip (a new exe is generated, but it is broken) and 7Zip (error message when adding mainAltered.msi "function not implemented")
I guess files are packed with a tool that forward the setup to the inner setup.exe, but I don't know it.
Do I need to use some kind of installer tools (InnoSetup etc.) to wrap the files ? In this case, how could I do it if I just want to pack the files, and run the setup.exe from inside the packed archive (I mean without introducing a intermediate window added by the installer tool itself) ?
Is there any simple way to do that please ?
Thanks,
To anymore interested, the best approach I found is to use WinZip Self-Extractor program (part of binaries created by WinZip, but different from the main WinZip program I tried to use for SFX, and that will not allow to tune options as far as I know).
You can request for automatic unzipping, set icon and run the inner setup.exe afterwards.
And, finally, it can be called from command line:
"C:\Program Files (x86)\WinZip Self-Extractor\WZIPSE32.EXE" test.zip -setup -t dialog.txt -auto -i icon.ico -c .\setup.exe

Resources