[PR #278] Optional string decoder delegate: fix #277 #946

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

Original Pull Request: https://github.com/adamhathcock/sharpcompress/pull/278

State: closed
Merged: Yes


A simple usage with SimpleHelpers.FileEncoding package (which is a Chardet helper):

var f = ArchiveFactory.Open(@"X:\some-really-old.zip", new ReaderOptions
{
    ArchiveEncoding = new ArchiveEncoding
    {
        CustomDecoder = (bytes, start, count) =>
            FileEncoding.DetectFileEncoding(bytes, start, count, Encoding.UTF8)
                .GetString(bytes, start, count)
    }
});
foreach (var entry in f.Entries)
{
    Debug.WriteLine(entry.Key);
}
**Original Pull Request:** https://github.com/adamhathcock/sharpcompress/pull/278 **State:** closed **Merged:** Yes --- A simple usage with [SimpleHelpers.FileEncoding](https://www.nuget.org/packages/SimpleHelpers.FileEncoding/) package (which is a Chardet helper): ``` var f = ArchiveFactory.Open(@"X:\some-really-old.zip", new ReaderOptions { ArchiveEncoding = new ArchiveEncoding { CustomDecoder = (bytes, start, count) => FileEncoding.DetectFileEncoding(bytes, start, count, Encoding.UTF8) .GetString(bytes, start, count) } }); foreach (var entry in f.Entries) { Debug.WriteLine(entry.Key); } ```
claunia added the pull-request label 2026-01-29 22:18:18 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#946