请告诉我,如何实现 Encoding.GetEncoding ("cp866")?在从存档导出的过程中,俄语符号未正确显示。
public static class ZipArchiveExtension
{
public static void ExtractToDirectory(this ZipArchive archive, string destinationDirectoryName, bool overwrite)
{
if (!overwrite)
{
archive.ExtractToDirectory(destinationDirectoryName);
return;
}
foreach (ZipArchiveEntry file in archive.Entries)
{
string completeFileName = Path.Combine(destinationDirectoryName, file.FullName);
if (file.Name == "")
{
Directory.CreateDirectory(Path.GetDirectoryName(completeFileName));
continue;
}
file.ExtractToFile(completeFileName, true);
}
}
}
FileStream zipToOpen = new FileStream(zipPath, FileMode.Open);
ZipArchive archive = new ZipArchive(zipToOpen);
ZipArchiveExtension.ExtractToDirectory(archive, extractPath, true);
zipToOpen.Dispose();
如 System.IO.Compression: ZipFile.ExtractToDirectory(zipPath, extractPath, Encoding.GetEncoding("cp866"));