Right now DotNetZip chooses a System.Text.Encoding to use, for encoding filenames and comments attached to ZipEntry items, based on a heuristic applied within the library, like this:
- use IBM437 (the default zip encoding) if it works
- if not, use an alternate encoding, which is specified in ProvisionalAlternateEncoding.
DotNetZip applies this heuristic to each entry independently. The result is that a zipfile can contain a number of entries, some of which are encoded with IBM437, and some of which are encoded with something else.
The request here is to allow a way to force a particular encoding: either UTF8, or a language-specific encoding, or something else.
This will require a change in property names at a minimum, in order to make sense. the "Provisional" in the ProvisionalAlternateEncoding property name which is present on ZipFile, ZipOutputStream, and ZipEntry, becomes no longer "provisional"
when it is forced. It is simply an AlternateEncoding, which is then applied in a different way: The current heuristic-driven approach (using the alt encoding "as necessary") can remain , and also the current option of "never" using the
alternate encoding. This change will add a new option, which is "always" use the alt encoding.
So the way I propose to implement this is to remove ProvisionalAlternateEncoding, and replace it with AlternateEncoding and AlternateEncodingUsage - the former is a System.Text.Encoding, and the latter is an enum with 3 values: AsNecessary, Always, Never.