mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-25 00:15:15 +00:00
ZipWriter: use ArchiveEncoding.Default
ShaprCompress is used internally in Mono to implement System.IO.Compression, which allows the user to specify path encoding. The change allows for specifying the encoding via ArchiveEncoding.Default.
This commit is contained in:
@@ -123,11 +123,11 @@ namespace SharpCompress.Writer.Zip
|
||||
|
||||
private int WriteHeader(string filename, DateTime? modificationTime)
|
||||
{
|
||||
byte[] encodedFilename = Encoding.UTF8.GetBytes(filename);
|
||||
byte[] encodedFilename = ArchiveEncoding.Default.GetBytes(filename);
|
||||
|
||||
OutputStream.Write(BitConverter.GetBytes(ZipHeaderFactory.ENTRY_HEADER_BYTES), 0, 4);
|
||||
OutputStream.Write(new byte[] {63, 0}, 0, 2); //version
|
||||
HeaderFlags flags = HeaderFlags.UTF8;
|
||||
HeaderFlags flags = ArchiveEncoding.Default == Encoding.UTF8 ? HeaderFlags.UTF8 : (HeaderFlags)0;
|
||||
if (!OutputStream.CanSeek)
|
||||
{
|
||||
flags |= HeaderFlags.UsePostDataDescriptor;
|
||||
@@ -158,7 +158,7 @@ namespace SharpCompress.Writer.Zip
|
||||
|
||||
private void WriteEndRecord(uint size)
|
||||
{
|
||||
byte[] encodedComment = Encoding.UTF8.GetBytes(zipComment);
|
||||
byte[] encodedComment = ArchiveEncoding.Default.GetBytes(zipComment);
|
||||
|
||||
OutputStream.Write(new byte[] {80, 75, 5, 6, 0, 0, 0, 0}, 0, 8);
|
||||
OutputStream.Write(BitConverter.GetBytes((ushort) entries.Count), 0, 2);
|
||||
|
||||
Reference in New Issue
Block a user