Apply Zip encoding patch from GordonJ

This commit is contained in:
Matt Nadareski
2021-09-08 22:52:23 -07:00
parent 00e0663ff3
commit 20b5266c54
4 changed files with 27 additions and 5 deletions

View File

@@ -33,6 +33,11 @@ namespace Compress.ZipFile
public ZipStatus ZipStatus { get; set; }
public Zip()
{
ZipUtils.EncodeSetup();
}
public int LocalFilesCount()
{
return _localFiles.Count;

View File

@@ -7,7 +7,15 @@ namespace Compress.ZipFile
{
// according to the zip documents, zip filesname are stored as MS-DOS Code Page 437.
// (Unless the uncode flag is set, in which case they are stored as UTF-8.
private static Encoding enc = Encoding.GetEncoding(437);
private static Encoding enc = null;
public static void EncodeSetup()
{
if (enc != null)
return;
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
enc = Encoding.GetEncoding(437);
}
public static string GetString(byte[] byteArr)
{