Answer the question
In order to leave comments, you need to log in
How to use Russian characters in zip password in Ionic.Zip?
Good afternoon. There was a task - to use zip files in the program on c#. I need password support when unzipping, so I installed Ionic.Zip.
The code is like this:
using Ionic.Zip;
using System;
using System.IO;
using System.Text;
namespace zipExtractor
{
class Program
{
static void Main(string[] args)
{
var isDebugMode = true;
var zipFileName = "archive.zip";
var passWord = "password";
var filesList = "1.txt";
//magic
using (ZipFile zip = ZipFile.Read(zipFileName, new ReadOptions { Encoding = Encoding.GetEncoding("cp866") }))
{
foreach (ZipEntry e in zip)
{
if (e.FileName==filesList)
{
e.ExtractWithPassword(ExtractExistingFileAction.OverwriteSilently, passWord);
if (isDebugMode)
{
Console.WriteLine($"{e.FileName}");
}
}
}
}
Console.ReadKey();
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question