[PR #266] [MERGED] Force encoding #934

Open
opened 2026-01-29 22:18:16 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/adamhathcock/sharpcompress/pull/266
Author: @eklann
Created: 7/5/2017
Status: Merged
Merged: 7/5/2017
Merged by: @adamhathcock

Base: masterHead: force-encoding


📝 Commits (8)

  • 2e95c23 Fixing build
  • 880001a Fixing build
  • 6976bdf Fixing build
  • 4758857 Fixed build (seems working now)
  • 7e979ea Added support to force specific encoding when reading or writing an archive
  • ece6b5f Merge branch 'master' into force-encoding
  • cb7df02 Minor fixed related to force encoding
  • 23b62db Removed obsolete project file not present in master

📊 Changes

31 files changed (+467 additions, -387 deletions)

View changed files

📝 src/SharpCompress/Archives/GZip/GZipArchive.cs (+8 -6)
📝 src/SharpCompress/Archives/Tar/TarArchive.cs (+5 -5)
📝 src/SharpCompress/Archives/Zip/ZipArchive.cs (+16 -13)
📝 src/SharpCompress/Common/GZip/GZipEntry.cs (+3 -2)
📝 src/SharpCompress/Common/GZip/GZipFilePart.cs (+9 -6)
📝 src/SharpCompress/Common/OptionsBase.cs (+5 -1)
📝 src/SharpCompress/Common/Rar/Headers/FileHeader.cs (+37 -35)
📝 src/SharpCompress/Common/Rar/Headers/RarHeader.cs (+9 -4)
📝 src/SharpCompress/Common/Rar/Headers/RarHeaderFactory.cs (+83 -81)
📝 src/SharpCompress/Common/Tar/Headers/TarHeader.cs (+6 -5)
📝 src/SharpCompress/Common/Tar/TarEntry.cs (+3 -2)
📝 src/SharpCompress/Common/Tar/TarHeaderFactory.cs (+18 -13)
📝 src/SharpCompress/Common/Zip/Headers/HeaderFlags.cs (+1 -0)
📝 src/SharpCompress/Common/Zip/Headers/LocalEntryHeader.cs (+1 -0)
📝 src/SharpCompress/Common/Zip/Headers/ZipFileEntry.cs (+15 -2)
📝 src/SharpCompress/Common/Zip/SeekableZipHeaderFactory.cs (+4 -3)
📝 src/SharpCompress/Common/Zip/StreamingZipHeaderFactory.cs (+3 -2)
📝 src/SharpCompress/Common/Zip/ZipHeaderFactory.cs (+63 -54)
📝 src/SharpCompress/Compressors/Deflate/DeflateStream.cs (+4 -2)
📝 src/SharpCompress/Compressors/Deflate/GZipStream.cs (+11 -5)

...and 11 more files

📄 Description

Added property ForceEncoding to OptionsBase, purpose is to be able to force reading from or writing to an archive to use the specified encoding.

The problem I am solving with this is the ability to unpack archives that has a non-standard encoding of the filenames. This is common for zip files.

The ArchiveEncoding.Default does not solve the problem, because of two reasons.

  1. It is global and can not be set per archive, and when multiple threads are used to unpack archives this is just not possible to use.
  2. If a zip file has the UTF-8-flag set AchiveEncoding.Default is not used, and I need to be able to force the use of a specific encoding regardless of any flags.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/adamhathcock/sharpcompress/pull/266 **Author:** [@eklann](https://github.com/eklann) **Created:** 7/5/2017 **Status:** ✅ Merged **Merged:** 7/5/2017 **Merged by:** [@adamhathcock](https://github.com/adamhathcock) **Base:** `master` ← **Head:** `force-encoding` --- ### 📝 Commits (8) - [`2e95c23`](https://github.com/adamhathcock/sharpcompress/commit/2e95c23a04c0db2b4f29b4787e1d0fc9a7e61005) Fixing build - [`880001a`](https://github.com/adamhathcock/sharpcompress/commit/880001a08c03cd8d73c7f665fef67f02bd8cab08) Fixing build - [`6976bdf`](https://github.com/adamhathcock/sharpcompress/commit/6976bdf4fe5b0d22575fc5df19006850055a1694) Fixing build - [`4758857`](https://github.com/adamhathcock/sharpcompress/commit/47588579d4e6ef3e4d05ae33897f4dc169fbf3d1) Fixed build (seems working now) - [`7e979ea`](https://github.com/adamhathcock/sharpcompress/commit/7e979ea2c28667732a0faafd993aabbc822c3629) Added support to force specific encoding when reading or writing an archive - [`ece6b5f`](https://github.com/adamhathcock/sharpcompress/commit/ece6b5fe4b12e3df925ecf64339ace5c6509d68a) Merge branch 'master' into force-encoding - [`cb7df02`](https://github.com/adamhathcock/sharpcompress/commit/cb7df02c1ff0aa4296974d555b8ebfba17c5a321) Minor fixed related to force encoding - [`23b62db`](https://github.com/adamhathcock/sharpcompress/commit/23b62db7193f5a858f4b200000de0d3423880283) Removed obsolete project file not present in master ### 📊 Changes **31 files changed** (+467 additions, -387 deletions) <details> <summary>View changed files</summary> 📝 `src/SharpCompress/Archives/GZip/GZipArchive.cs` (+8 -6) 📝 `src/SharpCompress/Archives/Tar/TarArchive.cs` (+5 -5) 📝 `src/SharpCompress/Archives/Zip/ZipArchive.cs` (+16 -13) 📝 `src/SharpCompress/Common/GZip/GZipEntry.cs` (+3 -2) 📝 `src/SharpCompress/Common/GZip/GZipFilePart.cs` (+9 -6) 📝 `src/SharpCompress/Common/OptionsBase.cs` (+5 -1) 📝 `src/SharpCompress/Common/Rar/Headers/FileHeader.cs` (+37 -35) 📝 `src/SharpCompress/Common/Rar/Headers/RarHeader.cs` (+9 -4) 📝 `src/SharpCompress/Common/Rar/Headers/RarHeaderFactory.cs` (+83 -81) 📝 `src/SharpCompress/Common/Tar/Headers/TarHeader.cs` (+6 -5) 📝 `src/SharpCompress/Common/Tar/TarEntry.cs` (+3 -2) 📝 `src/SharpCompress/Common/Tar/TarHeaderFactory.cs` (+18 -13) 📝 `src/SharpCompress/Common/Zip/Headers/HeaderFlags.cs` (+1 -0) 📝 `src/SharpCompress/Common/Zip/Headers/LocalEntryHeader.cs` (+1 -0) 📝 `src/SharpCompress/Common/Zip/Headers/ZipFileEntry.cs` (+15 -2) 📝 `src/SharpCompress/Common/Zip/SeekableZipHeaderFactory.cs` (+4 -3) 📝 `src/SharpCompress/Common/Zip/StreamingZipHeaderFactory.cs` (+3 -2) 📝 `src/SharpCompress/Common/Zip/ZipHeaderFactory.cs` (+63 -54) 📝 `src/SharpCompress/Compressors/Deflate/DeflateStream.cs` (+4 -2) 📝 `src/SharpCompress/Compressors/Deflate/GZipStream.cs` (+11 -5) _...and 11 more files_ </details> ### 📄 Description Added property ForceEncoding to OptionsBase, purpose is to be able to force reading from or writing to an archive to use the specified encoding. The problem I am solving with this is the ability to unpack archives that has a non-standard encoding of the filenames. This is common for zip files. The ArchiveEncoding.Default does not solve the problem, because of two reasons. 1. It is global and can not be set per archive, and when multiple threads are used to unpack archives this is just not possible to use. 2. If a zip file has the UTF-8-flag set AchiveEncoding.Default is not used, and I need to be able to force the use of a specific encoding regardless of any flags. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 22:18:16 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#934