mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-24 07:54:39 +00:00
ZipArchive Reader: Uses IBM PC character encoding to decode filename and comment if the general purpose bit 11 is not set in the header
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace SharpCompress.Common.Zip.Headers
|
||||
{
|
||||
@@ -16,6 +17,11 @@ namespace SharpCompress.Common.Zip.Headers
|
||||
Version = reader.ReadUInt16();
|
||||
VersionNeededToExtract = reader.ReadUInt16();
|
||||
Flags = (HeaderFlags)reader.ReadUInt16();
|
||||
if ((Flags & HeaderFlags.UTF8) == 0)
|
||||
{
|
||||
// IBM Code Page 437
|
||||
ArchiveEncoding.Default = Encoding.GetEncoding("iso-8859-1");
|
||||
}
|
||||
CompressionMethod = (ZipCompressionMethod)reader.ReadUInt16();
|
||||
LastModifiedTime = reader.ReadUInt16();
|
||||
LastModifiedDate = reader.ReadUInt16();
|
||||
|
||||
@@ -15,6 +15,11 @@ namespace SharpCompress.Common.Zip.Headers
|
||||
{
|
||||
Version = reader.ReadUInt16();
|
||||
Flags = (HeaderFlags)reader.ReadUInt16();
|
||||
if ((Flags & HeaderFlags.UTF8) == 0)
|
||||
{
|
||||
// IBM Code Page 437
|
||||
ArchiveEncoding.Default = Encoding.GetEncoding("iso-8859-1");
|
||||
}
|
||||
CompressionMethod = (ZipCompressionMethod)reader.ReadUInt16();
|
||||
LastModifiedTime = reader.ReadUInt16();
|
||||
LastModifiedDate = reader.ReadUInt16();
|
||||
|
||||
Reference in New Issue
Block a user