Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » plugin/Zip issue with UTF-8
plugin/Zip issue with UTF-8 [message #60406] Wed, 03 January 2024 16:21 Go to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Hi,

Just found a character encoding issue with plugin/Zip. When writing Zip files, the gpflag bit 11 should to be set for the filenames to be properly decoded by the reading program. (E.g. Windows 11 File Explorer incorrectly interprets the UTF-8 filenames written by plugin/Zip if the bit is not set.)

Please include the following fix:
void Zip::BeginFile(const char *path, Time tm, bool deflate)
{
	ASSERT(!IsFileOpened());
	if(deflate) {
		pipeZLib.Create();
		pipeZLib->WhenOut = THISBACK(PutCompressed);
		pipeZLib->GZip(false).CRC().NoHeader().Compress();
	}
	else {
		crc32.Clear();
		uncompressed = true;
	}
	File& f = file.Add();
	f.version = 21;
	f.gpflag = 0x8 | 1<<11; // Added UTF-8 marker, i.e.: " | 1<<11";
	f.method = deflate ? 8 : 0;
	f.crc = 0;
	f.csize = 0;
	f.usize = 0;
	FileHeader(path, tm);
	if (zip->IsError()) WhenError();
}


Found the gpflag bit to set here:

https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.0.TX T

Do not know if it is a safe site, but at least the bit to set was correct. Now Windows can read the filenames properly.

Best regards,

Tom
Re: plugin/Zip issue with UTF-8 and large files [message #60407 is a reply to message #60406] Thu, 04 January 2024 12:43 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Hi,

I managed to create broken ZIP files when adding large data files. It seems, plugin/Zip is missing Zip64 support. Would it be possible to add Zip64 support to handle large files?

I'm not quite sure how the additional records should be done to make it work...

Best regards,

Tom

[Updated on: Thu, 04 January 2024 12:44]

Report message to a moderator

Re: plugin/Zip issue with UTF-8 and large files [message #60415 is a reply to message #60407] Fri, 05 January 2024 17:15 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Hi,

I think I managed to add ZIP64 support in plugin/Zip. (Just for Zip now, not for UnZip...)

The above UTF-8 filename fix is also included here.

Please test and report any issues.

Best regards,

Tom
Re: plugin/Zip issue with UTF-8 and large files [message #60421 is a reply to message #60415] Sat, 06 January 2024 19:42 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1076
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Tom,

Could you prepare a PR for the main repository with your changes? This will save us time, and it will allow code review. Also, while merging, you will have credit in the form of being a co-creator.

Klugier


U++ - one framework to rule them all.
Re: plugin/Zip issue with UTF-8 and large files [message #60424 is a reply to message #60421] Sun, 07 January 2024 16:17 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Klugier wrote on Sat, 06 January 2024 20:42
Hello Tom,

Could you prepare a PR for the main repository with your changes? This will save us time, and it will allow code review. Also, while merging, you will have credit in the form of being a co-creator.

Klugier


Hi,

Sure, why not. I just need step-by-step instructions to do it. As for the credits, I'm not after them. I just want the feature to be part of u++.

Best regards,

Tom
Re: plugin/Zip issue with UTF-8 and large files [message #60460 is a reply to message #60424] Sat, 10 February 2024 20:07 Go to previous message
Klugier is currently offline  Klugier
Messages: 1076
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Tom,

There are no step by step instructions in our documentation, but the process is the same as for other repositories. You need to have GitHub account and create your own U++ fork. After that you can create dedicated branch to fix or work on the master. Once you will have everything prepeared on your branch you need to create PR from fork to upp master branch.

Here is GitHub documentation pages you can find useful:
- https://docs.github.com/en/pull-requests/collaborating-with- pull-requests/working-with-forks/fork-a-repo
- https://docs.github.com/en/pull-requests/collaborating-with- pull-requests/proposing-changes-to-your-work-with-pull-reque sts/creating-a-pull-request-from-a-fork

Klugier


U++ - one framework to rule them all.

[Updated on: Sat, 10 February 2024 21:24]

Report message to a moderator

Previous Topic: is memsetex really at optimal speed?
Next Topic: unsigned long / uint64 from Value type
Goto Forum:
  


Current Time: Sat May 04 04:25:06 CEST 2024

Total time taken to generate the page: 0.01896 seconds